I have been using node-red now for about 4 hours and I cannot find anywhere that tells me how to get mqtt parameters into the exec node. I want to pass On or off and the device ID. eg "Off j4" etc so it would be reusable flow.
If I pass the parameters using the injection it works. If I send the parameters by using this command to the broker. mosquitto_pub -h 192.168.0.164 -t 'coffee' -m "Off j4" I get the debug as seen on the attached screen shot.
On the exec node I had to spawn the command as it crashed node-red every time.
The exec node has the command /usr/local/bin/heyu and I have the tick for append msg.payload it passes the msg.payload if it is directly injected but not if I send it via mqtt
I thought I was going pretty good for a few hours until I hit this issue.
Anyone have any ideas or has someone managed to get this to work?
If I click on his link the shell out to heyu I get this:
[{"id":"32a2fac0.cd5d06","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"53861d46.ac79e4","type":"mqtt in","name":"","topic":"lights/bathroom","broker":"32a2fac0.cd5d06","x":186.7142562866211,"y":309.4285774230957,"z":"d1dcae04.2e235","wires":[["3b32f184.c4cd0e"]]},{"id":"3b32f184.c4cd0e","type":"function","name":"D9","func":"context.global.bathroomlight = msg.payload;\nmsg.payload = msg.payload + \" D9\";\nreturn msg;","outputs":1,"x":335.7142562866211,"y":309.4285774230957,"z":"d1dcae04.2e235","wires":[["90430c0f.6fbcf"]]},{"id":"90430c0f.6fbcf","type":"exec","command":"/usr/local/bin/heyu","append":"","useSpawn":"","name":"X10","x":567.7142562866211,"y":369.4285774230957,"z":"d1dcae04.2e235","wires":[[],[],[]]}]
Which I don't understand.
What is the secret that I am missing?
Thanks