biddster / node-red-contrib-time-range-switch

A simple Node-RED node that routes messages depending on the time.
18 stars 6 forks source link

question about start/end times that cross with the seasons #22

Closed rhd closed 5 years ago

rhd commented 5 years ago

Hi,

Thanks for this great little node. I have a question.

Say I want my lights to come on at 6am - sunrise. What happens if sunrise happens before 6am as it does in the summer time? In this case, I'd like to not have the lights come on at all.

Thanks!

biddster commented 5 years ago

@rhd I think this can be solved by having an inject node that fires at 6am. That's wired into time-range-switch which has a range from 1am (or any time that will always be before sunrise) until sunrise. Connect the lights to output 1 and output 2 to nothing. If 6am is after sunrise, time-range-switch will send to output 2 and nothing will happen. I have the exact same arrangement for my porch light.

rhd commented 5 years ago

@biddster thanks. That is how I ended up solving it. I guess this is more of an issue for schedex. It would be really nice if there was a checkbox that said don't fire if start time is before end time. Thanks for the great plugins... I'm going to close this issue.

rhd commented 5 years ago

image

My final solution didn't use time-range-switch - it used schdex to fire the events and the sun state in homeassistant to check to see if the sun was above or below the horizon. This could have been a time-range-switch instead.