How to trigger node injecting specific date


Hi all, I have NodeRed connected with Home Assistant.

I would like to trigger an action (set_cover_position to specific value) 30 minutes before the sun rises.

I was thinking in getting this value from "sun.sun" entity:

And triggering the set_cover_position service if current dates matches that with an offset of 30 minutes, but I really don’t know how to put the pieces together to implement this flow.

Anyone can guide me in the correct direction? Thanks a lot!


one way is to have one trigger that is for the date
and the other which is the sunrise use a join node. when the join gets both messages a message gets passed


or use something like the node-red-node-timeswitch node that will inject a 0 or 1 depending if between the hours you set (including sunrise with an offset). Then an RBE node to ensure you only get one transition (from 0 to 1 and 1 to 0)...


Or use the schedex node:


1 Like

That is exactly the solution I was looking for, except for I wanted to base my automation on "sun.sun" entity from Home Assistant (not sure where is schedex getting the sun rising/setting data by latitude/longitude from).

But will use your solution as it's very easy to implement, thanks a lot.


From Suncalc (almost all NR nodes use Suncalc)

1 Like