Hello you awesome folks.
Having some trouble with this, please can someone tell me what im doing wrong.
I have been through writing nodes and working with messages Node-Red docs and a few JavaScript informative sites.
I have a status node checking the status of of another node. Depending on the status it returns a payload of "Close" else "open" additional to this it needs a topic of "Control" its function is to control a gate node.
Here is a pic of the setup and the message coming from the debug.
Here is the flow
[{"id":"36595d31.ac5c6a","type":"status","z":"60367313.e04cac","name":"","scope":["abae7ff5.f68b88"],"x":800,"y":1320,"wires":[["959d5020.312ce"]]},{"id":"f35207e9.031418","type":"debug","z":"60367313.e04cac","name":"full message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1270,"y":1220,"wires":[]},{"id":"959d5020.312ce","type":"function","z":"60367313.e04cac","name":"test Message","func":"msg.topic =\"control\"\nif (msg.status.text === \"closed\") \n{\nmsg.payload = \"close\";\nreturn [msg, null];\n} \nelse \n{\nmsg.payload = \"open\";\nreturn [msg, null];\n}","outputs":1,"noerr":0,"x":1060,"y":1320,"wires":[["f35207e9.031418","2798b304.43e8dc"]]},{"id":"2798b304.43e8dc","type":"gate","z":"60367313.e04cac","name":"","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","persist":false,"x":1290,"y":1320,"wires":[[]]}]
My issue is is the Gate node is not recognizing the payload or the topic.
I used 2 inject nodes, used string"open" topic control & string "closed" topic control, worked OK.
Can you advise me what I'm doing wrong. This weekend i have completed the internet.
Thank you