Inject time change (hour)

Hi, I need to create an inject when the hour changes.
Some help please!

Is there a way to do that?

Use node-red-contrib-cron-plus for that with the expression: At minute 0 (0 * * * *)

The standard inject node set to interval between times, and set to every 60 minutes, will inject on the hour.
e.g.

[{"id":"3f35d274.99189e","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":1840,"wires":[]},{"id":"4bc4cca2.df47e4","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"0 0-23 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":480,"y":1880,"wires":[["3f35d274.99189e"]]}]

Though it is not reliable if your system is something like a Pi that does not have a hardware RTC, if the system clock does not synchronise before node-red is started, as can happen when using WiFi for example. Cron plus does cope with this situation.

If unreliable then maybe it should be noted in the node info help.

There is an open issue, but it is difficult to fix I think. inject node specific time - triggers late · Issue #1839 · node-red/node-red · GitHub

There appears to a work around to make node-red wait till time sync.

I have never suffered with any issues with timing, as my node-red delays restart till operating system has been started and running.

You should note, however, that this can make the startup completely hang if the Internet is down. There was a longish thread about this a while ago.

Yes i read that in the quote i posted.

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