Trigger every 6 hours but starting at 02:00?

Hi there,

I want to get messages every 6 hours and so I have a flow with an inject node at boot time connected to a a trigger node that is set every 6 hours. That works fine, but depends on the moment when I boot.

Is there an easy way to start triggering not at boot but lets say at 02:00 morning, so I get next value at 08:00, 14:00 etc. ?

Have a look at node-red-contrib-cron-plus. I am pretty sure that node can do that.

with Cron plus its real easy.
Expanding on Colin's suggestion .. you can use the following configuration



Great, looks really good. Thanks!

Or using a change node, Jsonata and a delay.
You set the trigger hour in the inject node ( 1 for 1 am, 2 for 2am, etc) But simpler using cronplus as it is all done for you

[{"id":"600b537a.9dcba4","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"starthour","v":"19","vt":"num"},{"p":"local","v":"Europe/London","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":1000,"wires":[["80994d6c.5601d"]]},{"id":"80994d6c.5601d","type":"change","z":"8d22ae29.7df6d","name":"","rules":[{"t":"set","p":"delay","pt":"msg","to":"($local := local;\t$starttime := starthour * 3600000;\t$timegap := $toMillis(\"1970-01-01T\" & $moment().tz($local).format('HH:mm:ss') & \"Z\");\t $timegap <= $starttime ? ($starttime - $timegap) : (86400000 + $starttime - $timegap);\t   \t   \t      )\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":1000,"wires":[["ca18810d.3ed83","b76ea11.89af86"]]},{"id":"b76ea11.89af86","type":"delay","z":"8d22ae29.7df6d","name":"","pauseType":"delayv","timeout":"5","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":1000,"wires":[["ba123fb5.f3788","ca18810d.3ed83"]]},{"id":"ba123fb5.f3788","type":"trigger","z":"8d22ae29.7df6d","name":"","op1":"1","op2":"1","op1type":"str","op2type":"str","duration":"6","extend":false,"units":"hr","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":600,"y":1000,"wires":[[]]}]

Thats one way :stuck_out_tongue:

Or 0 0 2/4 * * * *


1 Like


You must have ment 0 0 2/6 * * * *

Doh haha. That'll teach me.

Cron is so flexible & at the same time takes no prisoners :joy:


Just kidding,
You are THE expert, full respect!

1 Like

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