Hi,
I'm trying to get the following flow working. According to the debug output of "on" or "off", msg.payload is "1" or "0" as a number. But the status of pump says Invalid input: NaN
and nrgpio python command not running
, but
sudo -u nodejs-node-red ./nrgpio 11 1
works fine.
Flow in json:
[{"id":"9c89b46.7714ec8","type":"mqtt in","z":"8ce28174.9fb388","name":"","topic":"moisture","qos":"2","datatype":"auto","broker":"4eca0d68.048e1c","x":110,"y":140,"wires":[["6e2d378b.4cead"]]},{"id":"9f0cdea8.902a58","type":"switch","z":"8ce28174.9fb388","name":"moisture-check","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"150","vt":"num"},{"t":"gt","v":"150","vt":"num"}],"checkall":"false","repair":false,"outputs":2,"x":280,"y":140,"wires":[["6e928127.00bcb"],["cbd6ccf6.bdd2f"]]},{"id":"6e928127.00bcb","type":"change","z":"8ce28174.9fb388","name":"on","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":100,"wires":[["9dfe863e.05ef28","4cbb16b7.84f4"]]},{"id":"cbd6ccf6.bdd2f","type":"change","z":"8ce28174.9fb388","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":180,"wires":[["9dfe863e.05ef28","4cbb16b7.84f4"]]},{"id":"904486c0.910a88","type":"inject","z":"8ce28174.9fb388","name":"","topic":"","payload":"100","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":220,"wires":[["9f0cdea8.902a58"]]},{"id":"bc7c5992.5168","type":"status","z":"8ce28174.9fb388","name":"","scope":null,"x":520,"y":300,"wires":[["4cbb16b7.84f4"]]},{"id":"6e2d378b.4cead","type":"debug","z":"8ce28174.9fb388","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":280,"y":80,"wires":[]},{"id":"9dfe863e.05ef28","type":"debug","z":"8ce28174.9fb388","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":740,"y":60,"wires":[]},{"id":"4cbb16b7.84f4","type":"rpi-gpio out","z":"8ce28174.9fb388","name":"pump","pin":"11","set":"","level":"0","freq":"","out":"out","x":740,"y":180,"wires":[]},{"id":"4eca0d68.048e1c","type":"mqtt-broker","z":"","name":"localhost","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]