Mettre le periphId que l'on souhaite envoyer à Node-RED dans valeur brute
Pour les paramètres vous pouvez copier/coller ça sur chaque nouvelle ligne
- Code : Tout sélectionner
/pushEedomus?periphId=[RAW_VALUE]&value=[LAST_VALUE PERIPH_ID=[RAW_VALUE]]
dans paramètres
Coté Node-RED :
Voici le flow à importer
- Code : Tout sélectionner
[{"id":"8c2f2ff5.7901b","type":"debug","z":"45b4a4fe.34b43c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":420,"wires":[]},{"id":"a1d3ee0f.72148","type":"comment","z":"45b4a4fe.34b43c","name":"916824 - Mouvement salle à manger","info":"","x":620,"y":380,"wires":[]},{"id":"4075ee7b.a7445","type":"http in","z":"45b4a4fe.34b43c","name":"","url":"/pushEedomus","method":"get","upload":false,"swaggerDoc":"","x":130,"y":460,"wires":[["89d7723f.338e8","d27cb40e.6042f8"]]},{"id":"89d7723f.338e8","type":"template","z":"45b4a4fe.34b43c","name":"response","field":"payload","fieldType":"msg","format":"json","syntax":"mustache","template":"{\n \"success\": 1,\n \"payload\": {\n \"periphId\": \"{{payload.periphId}}\",\n \"value\": \"{{payload.value}}\"\n }\n}","output":"json","x":180,"y":400,"wires":[["20c30d82.5fa3b2"]]},{"id":"20c30d82.5fa3b2","type":"http response","z":"45b4a4fe.34b43c","name":"","statusCode":"","headers":{},"x":330,"y":400,"wires":[]},{"id":"d27cb40e.6042f8","type":"switch","z":"45b4a4fe.34b43c","name":"","property":"payload.periphId","propertyType":"msg","rules":[{"t":"eq","v":"916824","vt":"str"},{"t":"eq","v":"916825","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":350,"y":460,"wires":[["8c2f2ff5.7901b"],["c41ae64a.8e3b08"]]},{"id":"c41ae64a.8e3b08","type":"debug","z":"45b4a4fe.34b43c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":550,"y":520,"wires":[]},{"id":"ef9f2a30.378278","type":"comment","z":"45b4a4fe.34b43c","name":"916825 - Température salle à manger","info":"","x":630,"y":480,"wires":[]}]
Je préfère faire du push Eedomus vers Node-RED afin d'envoyer ce que je souhaite (règles lorsque le périphérique change de valeur par exemple) et non pas du polling Node-RED vers Eedomus.
La node http in permet d'avoir un Endpoint coté Node-RED
Pour la suite sur Node-RED :
https://cookbook.nodered.org/
https://nodered.org/docs/