Bonjour,
Je requière votre aide afin de comprendre pourquoi une fonction de mon flow ne fonctionne pas.
Voici le flow
[{"id":"fbcf2a1d21d4780f","type":"inject","z":"5056bad6e29e9cb7","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"40","payloadType":"num","x":1230,"y":180,"wires":[["a70759bef0fd1362"]]},{"id":"a70759bef0fd1362","type":"function","z":"5056bad6e29e9cb7","name":"Changement Niveau","func":"/*if (context.flow.get(\"vr_ouvr\") == 0 && context.flow.get(\"action\") == \"ouverture\") {\n context.flow.set(\"vr_ouvr\", 1, \"default\");\n}\nif (context.flow.get(\"vr_ferm\") == 0 && context.flow.get(\"action\") == \"fermeture\") {\n context.flow.set(\"vr_ferm\", 1, \"default\");\n}\nmsg.payload = {\n domain: \"homeassistant\",\n service: \"set_value\",\n target: {\n \"entity_id\": [\"input_number.volets_niveau_bureau\"]\n },\n data: {\n \"value\": context.flow.get(\"pourcentage\")\n \"value\": msg.payload\n }\n}*/\nmsg.payload = {\n domain: \"homeassistant\",\n service: \"set_value\",\n target: {\n \"entity_id\": [\"input_number.volets_niveau_bureau\"]\n },\n data: {\n \"value\": msg.payload\n }\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1600,"y":140,"wires":[["edd92d4715a18e0a","8c0e0cd3a1287b75"]],"info":"Met à jour le niveau d'ouverture affiché\r\nBloque à 1 la variable permettant de ne pas boucher"},{"id":"8c0e0cd3a1287b75","type":"api-call-service","z":"5056bad6e29e9cb7","name":"","server":"8ba7aec4.1022e","version":5,"debugenabled":false,"domain":"","service":"","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1930,"y":140,"wires":[["a29827db5a89b7de"]]},{"id":"edd92d4715a18e0a","type":"debug","z":"5056bad6e29e9cb7","name":"debug 127","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1870,"y":200,"wires":[]},{"id":"a29827db5a89b7de","type":"debug","z":"5056bad6e29e9cb7","name":"debug 130","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2110,"y":240,"wires":[]},{"id":"c857505616340b2d","type":"debug","z":"5056bad6e29e9cb7","name":"debug 131","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2130,"y":400,"wires":[]},{"id":"5464514303628974","type":"api-call-service","z":"5056bad6e29e9cb7","name":"","server":"8ba7aec4.1022e","version":5,"debugenabled":false,"domain":"input_number","service":"set_value","areaId":[],"deviceId":["c39d8e65a25cc96e65bd524011ba935a"],"entityId":["input_number.volets_niveau_bureau"],"data":"{\"value\": msg.payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1870,"y":340,"wires":[["c857505616340b2d"]]},{"id":"178f187a51e1d2b7","type":"inject","z":"5056bad6e29e9cb7","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30","payloadType":"num","x":1590,"y":340,"wires":[["5464514303628974"]]},{"id":"8ba7aec4.1022e","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]
Quand j’utilise le payload pour lancer le service, il ne me met aucune erreur mais l’input ne se met pas à jour. Si je mets toutes la conf dans le node ça fonctionne.
Je pense donc avoir une erreur dans ma syntaxe mais impossible de trouver ce qui ne lui plait pas.
Auriez-vous une idée?
Au cas ou, la fonction qui n’enclenche pas le service:
msg.payload = {
domain: "homeassistant",
service: "set_value",
target: {
"entity_id": ["input_number.volets_niveau_bureau"]
},
data: {
"value": msg.payload
}
}
return msg;
et mon msg sortant:
{"_msgid":"926fd978ccc62b72","payload":{"domain":"homeassistant","service":"set_value","target":{"entity_id":["input_number.volets_niveau_bureau"]},"data":{"value":40}}}
Voila si quelqu’un utilise déjà les services de cette façon, peut-il m’aider?
Merci