How to start a periodical task from an external command?

Hi everyone,
as the title of this topic says, I want to start a periodical task on Node-RED, triggering it from an external command.
I made an Android app and I'm gonna send an MQTT signal from it. When my flow receives this signal, it has to start a task that repeats every 15 minutes. How can I do it?
I obviously can't use the inject node. I tried to use the trigger node, but I managed to repeat the task only twice with it.

the cron-plus node is fully automatable.

  • add a cron expression that runs every 15m
  • send a topic of "stop" to it to stop it
  • send a topic of "start" to it to start it

See the built in help on the side bar for more details & see the built in examples (menu, import, examples, cron-plus)

how do you have the trigger node configured ? It should be possible no problem.


send any payload to start it, and send msg.reset to stop it.

Yeah, it should be......I configured it exactly as in your photo, but it doesn't work. I don't know why. I'm testing the cron-plus solution at the moment

what about it doesn't work ? It doesn't start ? it doesn't repeat ? It doesn't stop ?
a simple test case is working here...

[{"id":"4c8ef058.e86e9","type":"inject","z":"e9b4dddd.70115","name":"start","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":120,"wires":[["a712caf3.34ac68"]]},{"id":"a712caf3.34ac68","type":"trigger","z":"e9b4dddd.70115","name":"","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"-1","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":330,"y":140,"wires":[["a8cde462.c09df8"]]},{"id":"13e26bd4.352884","type":"inject","z":"e9b4dddd.70115","name":"reset","props":[{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":180,"wires":[["a712caf3.34ac68"]]},{"id":"a8cde462.c09df8","type":"debug","z":"e9b4dddd.70115","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":540,"y":140,"wires":[]}]
1 Like

As I said in the topic description, I managed to repeat the flow only twice, using trigger node.
I'll try this flow, maybe I set up something wrong. Anyway the cron-plus node is what I was looking for. The possibility to start, pause, resume and remove the schedules is awesome and very helpful for me.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.