Ok. Catch up.
Yes, I did/do have a debug
node before the function
node.
I'll get back to that.
This is the (now) flow.
Important parts only - of course.
[{"id":"226c024e.26a37e","type":"cronplus","z":"81be69fa.79ac","name":"Simple every 15 minutes","outputField":"payload","timeZone":"","options":[{"topic":"hourly","payload":"","type":"date","expression":"0 */15 * * * * *"}],"x":870,"y":1880,"wires":[["77f51755.886018","4b6f2fc4.f4875"]]},{"id":"f26321bb.af4fa8","type":"ui_button","z":"81be69fa.79ac","name":"Hourly","group":"a7e7bb4d.24e728","order":6,"width":"3","height":"1","passthru":false,"label":"Hourly","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"H","payloadType":"str","topic":"","x":400,"y":1960,"wires":[["8b470c04.d69c68","bbfbe762.446ac8"]]},{"id":"9ee5daf5.3357a8","type":"ui_button","z":"81be69fa.79ac","name":"30 minute","group":"a7e7bb4d.24e728","order":5,"width":"3","height":"1","passthru":false,"label":"30 minute","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"30","payloadType":"str","topic":"","x":410,"y":1920,"wires":[["485e4bd9.cf8254","bbfbe762.446ac8"]]},{"id":"2ce08563.4625a2","type":"ui_button","z":"81be69fa.79ac","name":"15 minute","group":"a7e7bb4d.24e728","order":4,"width":"3","height":"1","passthru":false,"label":"15 minute","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"15","payloadType":"str","topic":"","x":410,"y":1880,"wires":[["2f66691.0f60316","bbfbe762.446ac8"]]},{"id":"4c6c0987.03a4a8","type":"ui_button","z":"81be69fa.79ac","name":"10 minute","group":"a7e7bb4d.24e728","order":3,"width":"3","height":"1","passthru":false,"label":"10 minute","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"10","payloadType":"str","topic":"","x":410,"y":1840,"wires":[["e32937d2.229988","bbfbe762.446ac8"]]},{"id":"5936f564.5817b4","type":"ui_button","z":"81be69fa.79ac","name":"5 minute","group":"a7e7bb4d.24e728","order":2,"width":"3","height":"1","passthru":false,"label":"5 minute","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"5","payloadType":"str","topic":"","x":410,"y":1800,"wires":[["8a9fa56.9977958","bbfbe762.446ac8"]]},{"id":"d1c397f6.517be","type":"ui_button","z":"81be69fa.79ac","name":"STOP","group":"a7e7bb4d.24e728","order":1,"width":"3","height":"1","passthru":false,"label":"STOP","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"{\"command\": \"remove-all\"}","payloadType":"json","topic":"","x":360,"y":1650,"wires":[["226c024e.26a37e","ea1c8e56.d96a18"]]},{"id":"8a9fa56.9977958","type":"trigger","z":"81be69fa.79ac","op1":"{\"command\": \"remove-all\"}","op2":"{\"command\":\"add\",\"name\":\"5\",\"payload\":\"5\",\"expression\":\"0 */5 * * * * *\"}","op1type":"json","op2type":"json","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":580,"y":1800,"wires":[["226c024e.26a37e"]]},{"id":"e32937d2.229988","type":"trigger","z":"81be69fa.79ac","op1":"{\"command\": \"remove-all\"}","op2":"{\"command\":\"add\",\"name\":\"10\",\"payload\":\"10\",\"expression\":\"0 */10 * * * * *\"}","op1type":"json","op2type":"json","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":580,"y":1840,"wires":[["226c024e.26a37e"]]},{"id":"2f66691.0f60316","type":"trigger","z":"81be69fa.79ac","op1":"{\"command\": \"remove-all\"}","op2":"{\"command\":\"add\",\"name\":\"15\",\"payload\":\"15\",\"expression\":\"0 */15 * * * * *\"}","op1type":"json","op2type":"json","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":580,"y":1880,"wires":[["226c024e.26a37e"]]},{"id":"485e4bd9.cf8254","type":"trigger","z":"81be69fa.79ac","op1":"{\"command\": \"remove-all\"}","op2":"{\"command\":\"add\",\"name\":\"30\",\"payload\":\"30\",\"expression\":\"0 */30 * * * * *\"}","op1type":"json","op2type":"json","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":580,"y":1920,"wires":[["226c024e.26a37e"]]},{"id":"8b470c04.d69c68","type":"trigger","z":"81be69fa.79ac","op1":"{\"command\": \"remove-all\"}","op2":"{\"command\":\"add\",\"name\":\"H\",\"payload\":\"H\",\"expression\":\"0 0 * * * * *\"}","op1type":"json","op2type":"json","duration":"250","extend":false,"units":"ms","reset":"","bytopic":"all","name":"","x":580,"y":1960,"wires":[["226c024e.26a37e"]]},{"id":"fc5220a.fbca1e","type":"function","z":"81be69fa.79ac","name":"","func":"let A = \"lime\";\nlet B = \"green\";\n\nlet msg1 = {};\nlet msg2 = {};\nlet msg3 = {};\nlet msg4 = {};\nlet msg5 = {};\nlet msg6 = {};\n\nnode.warn(msg.payload);\n\nif (msg.payload == \"5\")\n{\n //\n// node.warn(\"5 minute\");\n msg1 = {\"background\":A};\n msg2 = {\"background\":B};\n msg3 = {\"background\":B};\n msg4 = {\"background\":B};\n msg5 = {\"background\":B};\n msg6 = {\"background\":B};\n} else\nif (msg.payload == \"10\")\n{\n //\n// node.warn(\"10 minute\");\n msg1 = {\"background\":B};\n msg2 = {\"background\":A};\n msg3 = {\"background\":B};\n msg4 = {\"background\":B};\n msg5 = {\"background\":B};\n msg6 = {\"background\":B};\n} else\nif (msg.payload == \"15\")\n{\n //\n// node.warn(\"15 minute\");\n msg1 = {\"background\":B};\n msg2 = {\"background\":B};\n msg3 = {\"background\":A};\n msg4 = {\"background\":B};\n msg5 = {\"background\":B};\n msg6 = {\"background\":B};\n} else\nif (msg.payload == \"30\")\n{\n //\n// node.warn(\"30 minute\");\n msg1 = {\"background\":B};\n msg2 = {\"background\":B};\n msg3 = {\"background\":B};\n msg4 = {\"background\":A};\n msg5 = {\"background\":B};\n msg6 = {\"background\":B};\n} else\nif (msg.payload == \"H\")\n{\n //\n// node.warn(\"60 minute\");\n msg1 = {\"background\":B};\n msg2 = {\"background\":B};\n msg3 = {\"background\":B};\n msg4 = {\"background\":B};\n msg5 = {\"background\":A};\n msg6 = {\"background\":B};\n}\nelse\nif (msg.payload == \"STOP\")\n{\n msg1 = {\"background\":B};\n msg2 = {\"background\":B};\n msg3 = {\"background\":B};\n msg4 = {\"background\":B};\n msg5 = {\"background\":B};\n msg6 = {\"background\":A};\n}\nreturn [msg1,msg2,msg3,msg4,msg5];\n","outputs":6,"noerr":0,"x":250,"y":1880,"wires":[["5936f564.5817b4"],["4c6c0987.03a4a8"],["2ce08563.4625a2"],["9ee5daf5.3357a8"],["f26321bb.af4fa8"],["d1c397f6.517be"]]},{"id":"bbfbe762.446ac8","type":"link out","z":"81be69fa.79ac","name":"","links":["b0614db5.48821"],"x":705,"y":1690,"wires":[]},{"id":"b0614db5.48821","type":"link in","z":"81be69fa.79ac","name":"","links":["bbfbe762.446ac8"],"x":135,"y":1880,"wires":[["ff0180a8.3d001","fc5220a.fbca1e"]]},{"id":"ff0180a8.3d001","type":"debug","z":"81be69fa.79ac","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":200,"y":1800,"wires":[]},{"id":"ea1c8e56.d96a18","type":"change","z":"81be69fa.79ac","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"STOP","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":1650,"wires":[["bbfbe762.446ac8"]]},{"id":"a7e7bb4d.24e728","type":"ui_group","name":"Group 2","tab":"961307de.db94a8","order":2,"disp":true,"width":6},{"id":"961307de.db94a8","type":"ui_tab","z":"","name":"Real World Control","icon":"public","order":16,"disabled":false,"hidden":false}]
The buttons create a signal which I now use (via the cheat method I mentioned a couple of posts back) and that is sent to the function
node for parsing.
I also said I fixed the msg1
declaration.
(No problems.)
So back to the debug
part.
The button
sent an input to the trigger
node which sent a wipe all
then shortly there after sends a command to create a timer event.
The payload was specified:
(example:)
{"command":"add","name":"5","payload":"5","expression":"0 */5 * * * * *"}
I copied that from the debug
node just before the function
node's input.
I stated what I thought were the parts of the message.
Maybe that was tripped up by the fact I hadn't declared msg1
msg2
msg3
msg4
at that time.
Sorry. Really.
So with the latest bit of the flow..... (Sorry) Could you load it and just check it over.
As far as I can see it seems to be working.
I know I could use the pause
and start
commands.
Quickie: What's the difference between stop
and pause
?
Anyway.
How's what I posted looking?