fellinga / node-red-contrib-ui-time-scheduler

Easily power on/off any kind of device based on a schedule that you can easily create at the node-red-dashboard frontend.
MIT License
37 stars 17 forks source link

Mixed Start and Endtypes - Sunset and Clock #74

Closed HubertusH closed 2 years ago

HubertusH commented 2 years ago

Solving the problem with the event node is messy. If - to give another example - light on at 6:00 am and off after sunrise. If now the sunrise is BEFORE 6:00 the light should not turn on at all. In the case of the proposed event mode, the light would turn on at 6:00 but not off again (only the next day after sunrise and then immediately on again when 6:00 is reached).

The check could simply ignore the event in case of negative time differences/running times.

Best regards Hubertus

Originally posted by @HubertusH in https://github.com/fellinga/node-red-contrib-ui-time-scheduler/issues/33#issuecomment-1072274629

fellinga commented 2 years ago

Hi @HubertusH,

thanks for your feedback.

From my perspective ignoring negative time differences might sounds like a good and simple solution, but the problem is a little more complex than that. For example if the user selects sunset as start type and sunrise as end type then I consider this as perfectly valid even though there is also a negative time difference. In this case the time scheduler adds 24 hours to the end time which would lead to a timer that for example starts at 20:06 and ends at 05:31, nothing wrong about that.

Could you explain in more detail how your proposed solution would look like?

fellinga commented 2 years ago

FYI: It's now possible to mix start and end time but without any check when they overlap.

HubertusH commented 2 years ago

sorry for my delay ;-) i read your message only today. My application for this are different lights that should turn on at a certain time 06:00 in the morning and turn off after sunrise (+ x min). If the sunrise is before 6:00 the lights should not turn on. In the evening then vice versa: on before sunset (-x min) and off at 23:00. Where it is likely that the sun sets before.