I think it is more to do with what time it is here now.
Simple thing:
values (numbers) go into a function
node.
If it is 70, one thing happens.
If it is 75, another thing happens.
For testing, I also check if the value is "test".
It isn't working.
I am seeing the first node.warn( )
and the second one.
But not the third.
And not getting an output.
Injecting 70 (number)
I just added 3 lines to set up msg1
, msg2
and msg3
which has kind of helped. But not solved the problem.
[{"id":"3478f7f3.682718","type":"inject","z":"675e227d.d158b4","name":"70","topic":"","payload":"70","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1770,"y":80,"wires":[["f08765be.6acb68"]]},{"id":"8ef67943.0946e8","type":"inject","z":"675e227d.d158b4","name":"test","topic":"","payload":"TEST","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1770,"y":120,"wires":[["f08765be.6acb68"]]},{"id":"f08765be.6acb68","type":"function","z":"675e227d.d158b4","name":"Make message","func":"node.warn(\"Payload \" + msg.payload);\n\nnode.warn(\"a\");\n\n// Set up messages\nmsg1.payload = {\n event: \"Over temperature\",\n priotiry: 1\n}\n\nnode.warn(\"1\");\n\nmsg2.payload = {\n event:\"BedPi shutting down. Excess heat\",\n priority: 4\n}\nmsg3.payload = {\n DEVICE:\"BedPi\",COMMAND:\"Shutdown\",state:1\n}\n\nnode.warn(\"Got here ok\");\nvar z = parseInt(msg.payload);\nnode.warn(\"Payload \" + msg.payload);\n\nif (msg.payload == 70)\n{\n return [msg1,null,null];\n} else\nif (msg.payload == 75)\n{\n return [msg1, msg2, msg3];\n} else\nif (msg.payload == \"TEST\")\n{\n return [msg1,msg2,null];\n}","outputs":3,"noerr":0,"x":1940,"y":160,"wires":[["ac098d23.584e2","2d3ef271.888286"],["e74c05a9.5c3958"],["82f08226.354798"]],"outputLabels":["A1","Shutdown command","A4"]}]