CRON Plus help please

Hey folks.

I am not getting all these fancy tricks with the cronplus node.

I sort of do and sort of don't.

Although there are examples given, I can't get from them what I want.

I am wanting to inject a command to add (or better saying: create) a job.

Is that what is called describe?

What I am wanting to get/create:
a message/command to send into the node so I get:
5 minute pulses,
10 minute pulses,
15 minute pulses,
30 minute pulses,
hourly pulses

The idea is that these are buttons.
The button goes through a trigger node which firstly erases any existing queues then sends the new message/command.

Anyone.
Someone.

For this part, I'd suggest you add them manually.

Then you can pause and resume through UI Buttons by sending a JS object formated like the document says...
image

e.g. this will pause 5m timer...

{
    "command": "pause",
    "name": "5m"
}

e.g. this will resume 5m timer...

{
    "command": "start",
    "name": "5m"
}

[{"id":"f71057ce.e6e458","type":"cronplus","z":"2295c081.bedb1","name":"","outputField":"payload","timeZone":"","options":[{"topic":"5m","payload":"true","type":"bool","expression":"0 0/5 * * * *"},{"topic":"10m","payload":"true","type":"bool","expression":"0 0/10 * * * *"},{"topic":"15m","payload":"","type":"str","expression":"0 0/15 * * * *"},{"topic":"30m","payload":"true","type":"bool","expression":"0 0/30 * * * *"},{"topic":"1h","payload":"true","type":"bool","expression":"0 0 * * * *"}],"x":400,"y":160,"wires":[["aec9c629.a3b0f8"]]},{"id":"aec9c629.a3b0f8","type":"switch","z":"2295c081.bedb1","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5m","vt":"str"},{"t":"eq","v":"10m","vt":"str"},{"t":"eq","v":"15m","vt":"str"},{"t":"eq","v":"30m","vt":"str"},{"t":"eq","v":"1h","vt":"str"}],"checkall":"true","repair":false,"outputs":5,"x":630,"y":160,"wires":[["a14869a7.6f3678"],["afdf1e10.44b2a"],["fce53e2c.844cc"],["ab4b1ff1.36e1c"],["37a62ec0.d8a392"]]},{"id":"a14869a7.6f3678","type":"debug","z":"2295c081.bedb1","name":"do stuff every 5 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":80,"wires":[]},{"id":"afdf1e10.44b2a","type":"debug","z":"2295c081.bedb1","name":"do stuff every 10 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":120,"wires":[]},{"id":"fce53e2c.844cc","type":"debug","z":"2295c081.bedb1","name":"do stuff every 15 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":160,"wires":[]},{"id":"ab4b1ff1.36e1c","type":"debug","z":"2295c081.bedb1","name":"do stuff every 30 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":200,"wires":[]},{"id":"37a62ec0.d8a392","type":"debug","z":"2295c081.bedb1","name":"do stuff every 1 hour","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":240,"wires":[]},{"id":"be140172.18f3e","type":"ui_button","z":"2295c081.bedb1","name":"","group":"ee7a28ba.02a0c8","order":6,"width":0,"height":0,"passthru":false,"label":"Pause 5m timer","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"command\":\"pause\",\"name\":\"5m\"}","payloadType":"json","topic":"","x":400,"y":60,"wires":[["f71057ce.e6e458"]]},{"id":"aecb1219.62684","type":"ui_button","z":"2295c081.bedb1","name":"","group":"ee7a28ba.02a0c8","order":6,"width":0,"height":0,"passthru":false,"label":"Resume 5m timer","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"command\":\"start\",\"name\":\"5m\"}","payloadType":"json","topic":"","x":390,"y":100,"wires":[["f71057ce.e6e458"]]},{"id":"ee7a28ba.02a0c8","type":"ui_group","z":"","name":"Default","tab":"afa587ca.3101f8","disp":true,"width":"6","collapse":false},{"id":"afa587ca.3101f8","type":"ui_tab","z":"","name":"CRON STUFF","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

I do appreciate the info.

(You are of the idea I can read.) (:stuck_out_tongue_winking_eye:)

In the mean time I got something working. Though your trick is nice.

I'm not quite getting why the 15m is different, but I'll let that one go to the keeper.

I hadn't worked out that I could do what you showed in the example. Though maybe I had.
It is a bit confusing.

This is what I nutted out myself.

[{"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":710,"y":1880,"wires":[["e51bafa7.ae3828"]]},{"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":260,"y":1960,"wires":[["8b470c04.d69c68"]]},{"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":"T","payloadType":"str","topic":"","x":250,"y":1920,"wires":[["485e4bd9.cf8254"]]},{"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":"F","payloadType":"str","topic":"","x":250,"y":1880,"wires":[["2f66691.0f60316"]]},{"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":"F","payloadType":"str","topic":"","x":250,"y":1840,"wires":[["e32937d2.229988"]]},{"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":"F","payloadType":"str","topic":"","x":250,"y":1800,"wires":[["8a9fa56.9977958"]]},{"id":"d1c397f6.517be","type":"ui_button","z":"81be69fa.79ac","name":"STOP","group":"a7e7bb4d.24e728","order":1,"width":"3","height":"1","passthru":false,"label":"15 minute","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"command\": \"remove-all\"}","payloadType":"json","topic":"","x":450,"y":1760,"wires":[["226c024e.26a37e","e92ee9dc.cba3d"]]},{"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":420,"y":1800,"wires":[["226c024e.26a37e","bbfbe762.446ac8"]]},{"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":420,"y":1840,"wires":[["226c024e.26a37e","bbfbe762.446ac8"]]},{"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":420,"y":1880,"wires":[["226c024e.26a37e","bbfbe762.446ac8"]]},{"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":420,"y":1920,"wires":[["226c024e.26a37e","bbfbe762.446ac8"]]},{"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":420,"y":1960,"wires":[["226c024e.26a37e","bbfbe762.446ac8"]]},{"id":"fc5220a.fbca1e","type":"function","z":"81be69fa.79ac","name":"","func":"let A = \"lime\";\nlet B = \"green\";\n\nif (msg.payload == \"5\")\n{\n    //\n    msg1 = {\"msg.background\":A};\n    msg2 = {\"msg.background\":B};\n    msg3 = {\"msg.background\":B};\n    msg4 = {\"msg.background\":B};\n    msg5 = {\"msg.background\":B};\n} else\nif (msg.payload == \"10\")\n{\n    //\n    msg1 = {\"msg.background\":B};\n    msg2 = {\"msg.background\":A};\n    msg3 = {\"msg.background\":B};\n    msg4 = {\"msg.background\":B};\n    msg5 = {\"msg.background\":B};\n} else\nif (msg.payload == \"15\")\n{\n    //\n    msg1 = {\"msg.background\":B};\n    msg2 = {\"msg.background\":B};\n    msg3 = {\"msg.background\":A};\n    msg4 = {\"msg.background\":B};\n    msg5 = {\"msg.background\":B};\n} else\nif (msg.payload == \"30\")\n{\n    //\n    msg1 = {\"msg.background\":B};\n    msg2 = {\"msg.background\":B};\n    msg3 = {\"msg.background\":B};\n    msg4 = {\"msg.background\":A};\n    msg5 = {\"msg.background\":B};\n} else\nif (msg.payload == \"H\")\n{\n    //\n    msg1 = {\"msg.background\":B};\n    msg2 = {\"msg.background\":B};\n    msg3 = {\"msg.background\":B};\n    msg4 = {\"msg.background\":B};\n    msg5 = {\"msg.background\":A};\n}\nreturn [msg1,msg2,msg3,msg4,msg5];\n","outputs":5,"noerr":0,"x":90,"y":1880,"wires":[["5936f564.5817b4"],["4c6c0987.03a4a8"],["2ce08563.4625a2"],["9ee5daf5.3357a8"],["f26321bb.af4fa8"]]},{"id":"bbfbe762.446ac8","type":"link out","z":"81be69fa.79ac","name":"","links":["b0614db5.48821"],"x":615,"y":1800,"wires":[]},{"id":"b0614db5.48821","type":"link in","z":"81be69fa.79ac","name":"","links":["bbfbe762.446ac8"],"x":75,"y":1800,"wires":[["fc5220a.fbca1e"]]},{"id":"e92ee9dc.cba3d","type":"debug","z":"81be69fa.79ac","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":670,"y":1760,"wires":[]},{"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}]

I need to know how to add a payload to the STOP button so I can detect if it has been pressed.

Please don't be upset if it seems I don't like your reply. I asked the question but kept the nose to the grind stone after that and so this is where we are at.

I'll look over it and see what I can get form it.

Oh, the function node.

I goofed and forgot to declare the msg1 msg2 msg3 msg4 and msg5.
Lines now added.

typo (i.m not perfect :stuck_out_tongue:

If you mean you want feedback from CRONPLUS to know if the item IS actually stopped then you can send 2 commands in an array from the button

  • command 1 = pause the timer
  • command 2 = get status of the timer
[
    {
        "command": "pause",
        "name": "5m"
    },
    {
        "command": "status",
        "name": "5m"
    }
]

and you'll get back ...

[{"id":"f71057ce.e6e458","type":"cronplus","z":"2295c081.bedb1","name":"","outputField":"payload","timeZone":"","options":[{"topic":"5m","payload":"true","type":"bool","expression":"0 0/5 * * * *"},{"topic":"10m","payload":"true","type":"bool","expression":"0 0/10 * * * *"},{"topic":"15m","payload":"true","type":"bool","expression":"0 0/15 * * * *"},{"topic":"30m","payload":"true","type":"bool","expression":"0 0/30 * * * *"},{"topic":"1h","payload":"true","type":"bool","expression":"0 0 * * * *"}],"x":400,"y":160,"wires":[["aec9c629.a3b0f8"]]},{"id":"aec9c629.a3b0f8","type":"switch","z":"2295c081.bedb1","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"5m","vt":"str"},{"t":"eq","v":"10m","vt":"str"},{"t":"eq","v":"15m","vt":"str"},{"t":"eq","v":"30m","vt":"str"},{"t":"eq","v":"1h","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":6,"x":630,"y":160,"wires":[["a14869a7.6f3678"],["afdf1e10.44b2a"],["fce53e2c.844cc"],["ab4b1ff1.36e1c"],["37a62ec0.d8a392"],["e6853a86.fed508"]]},{"id":"a14869a7.6f3678","type":"debug","z":"2295c081.bedb1","name":"do stuff every 5 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":80,"wires":[]},{"id":"afdf1e10.44b2a","type":"debug","z":"2295c081.bedb1","name":"do stuff every 10 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":120,"wires":[]},{"id":"fce53e2c.844cc","type":"debug","z":"2295c081.bedb1","name":"do stuff every 15 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":160,"wires":[]},{"id":"ab4b1ff1.36e1c","type":"debug","z":"2295c081.bedb1","name":"do stuff every 30 mins","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":200,"wires":[]},{"id":"37a62ec0.d8a392","type":"debug","z":"2295c081.bedb1","name":"do stuff every 1 hour","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":240,"wires":[]},{"id":"be140172.18f3e","type":"ui_button","z":"2295c081.bedb1","name":"","group":"ee7a28ba.02a0c8","order":6,"width":0,"height":0,"passthru":false,"label":"Pause 5m timer","tooltip":"","color":"","bgcolor":"","icon":"","payload":"[{\"command\":\"pause\",\"name\":\"5m\"},{\"command\":\"status\",\"name\":\"5m\"}]","payloadType":"json","topic":"","x":400,"y":60,"wires":[["f71057ce.e6e458"]]},{"id":"aecb1219.62684","type":"ui_button","z":"2295c081.bedb1","name":"","group":"ee7a28ba.02a0c8","order":6,"width":0,"height":0,"passthru":false,"label":"Resume 5m timer","tooltip":"","color":"","bgcolor":"","icon":"","payload":"[{\"command\":\"start\",\"name\":\"5m\"},{\"command\":\"status\",\"name\":\"5m\"}]","payloadType":"json","topic":"","x":390,"y":100,"wires":[["f71057ce.e6e458"]]},{"id":"e6853a86.fed508","type":"debug","z":"2295c081.bedb1","name":"Other stuff","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":850,"y":280,"wires":[]},{"id":"ee7a28ba.02a0c8","type":"ui_group","z":"","name":"Default","tab":"afa587ca.3101f8","disp":true,"width":"6","collapse":false},{"id":"afa587ca.3101f8","type":"ui_tab","z":"","name":"CRON STUFF","icon":"dashboard","disabled":false,"hidden":false}]

The input/output and control of the cron-plus node is pretty decent.
I'm gonna add a tag line to this node...
"Limited only by your imagination" :slight_smile:

Oh, it is. I can't read.

If you have looked at my flow, you can see how I am getting the state of things. I am sending the commands from the buttons back into the function node and parsing the message there.

The next thing that has thrown me is the message I am sending.

{"command":"add","name":"5","payload":"5","expression":"0 */5 * * * * *"}

Ok, I'm stuck.

To me, if I receive that there are these parts:

  • command
  • name
  • payload
  • expression.

So, why is it that in the function node I can't see (or am not seeing) a msg.payload?

What I posted there (the code/output) is from the debug node before going into the function node.

I've tried adding a JSON node. No luck.

So I'm confused to what is going on with that part.

I just thought of a cheat:
Send the message directly from the button back to the function node.
That may work.

But if you could help with the question all the same it would be appreciated.

I also fixed the problem with the message construction in the function node.

msg = {"background":A};

The only problem I seen was you didnt declare msg1~msg5 otherwise I do see command:add

Have you looked at what is being sent into the function node by adding a debug node (displaying the complete msg object) to the link-in node?

It also looks like you have some errors in the function node -

"ReferenceError: msg1 is not defined (line 49, col 9)"

NOTE: Your stop button has a label of '15 MINUTE' so you display 2 '15 MINUTE' buttons.

1 Like

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?

Documentation...
image

Don't fret Steve. It is my bad luck rubbing off on you. I'm not a good person for that sort of stuff.

Ok. Thanks.

That helps. As I am sending the schedules with the button presses, I guess it is a bit academic.

@Trying_to_learn why don't you connect an inject node - with {"command": "remove-all"} in the payload - to the cron-plus node and add a debug node (set to display the complete msg object) to the output of the cron-plus so you can see what effect each of your buttons/changes are doing....

Well, this is what I believe you mean:

[{"id":"8ee64bc1.0de4e8","type":"inject","z":"b86527b7.8c79f","name":"remove-all","topic":"","payload":"{\"command\": \"remove-all\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":2130,"wires":[["e3340a17.f0727","d0f5be35.df06d"]]},{"id":"d0f5be35.df06d","type":"debug","z":"b86527b7.8c79f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":280,"y":2130,"wires":[]},{"id":"e3340a17.f0727","type":"cronplus","z":"b86527b7.8c79f","name":"","outputField":"payload","timeZone":"","options":[],"x":290,"y":2180,"wires":[["7b4d22cd.a6b894"]]}]

This is what I see:

{"_msgid":"a9428070.ca2c2","topic":"","payload":{"command":"remove-all"}}

The payload is an "object".
So I can't parse that structure in the function node if it is only looking at msg.payload.

So that's why I cheated and took the output of the button rather than what was going into the cron+ node.