A clock node that will emit correct payload on startup?

Is there an existing clock node that will emit the correct payload (for example, "on" or "off) on start up? Specifically, is there a clock node that will GO BACKWARDS to the last event in time and correctly set the payload?

I am currently using "schedex" and it appears there is no way to prompt it to go backwards to the last event. It looks like it only knows about the next two events. So, for example, you schedule to turn on lights at sun set and turn them off at sun rise. If you start NodeRed 1 minute after sun set, the lights will not turn on for at least another 23 hours. Ideally the lights would turn on when ever it is dark and NodeRed is started.

2 Likes

What you are describing here is not that simple.

There is a node: big_timer which can do a lot of what you want.
Here
It sends messages at Sunrise/Sunset.

You send that output through a switch node to split between rise and set.
Then when the message is received it does what it needs to, to open/close blinds, etc.

Not only does it do sunrise/set, but it does DAWN and DUSK, and a whole lot of other stuff.

It just may be for what you are looking.

Focusing on the question you asked:
You use the inject node.
Set it from timestamp to what ever you want to inject, and tick the inject at startup.
Oh, ironically the inject node defaults to timestamp which is the time at that point in . . . . . time.

The node-red-node-timeswitch has two outputs - one that only sends at the switch times and one that sends every minute of the current state... as you require.