nielsfaber / scheduler-component

Custom component for HA that enables the creation of scheduler entities
GNU General Public License v3.0
622 stars 40 forks source link

Prevent daily schedule from being executed at 00:00 if the target state does not differ #270

Closed LinusHoppe closed 11 months ago

LinusHoppe commented 1 year ago

Checklist

tl;dr

I need day-overlapping time schemes, e. g. Monday 22:00 to Tuesday 06:00. As this is unlikely to happen, I would love to have an option for time schemes to not trigger any action if the previous target state does not differ from the current target state. This would allow me to mark time schemes starting at midnight as "do not trigger".

Proposal

I have a lot of daily schedules for heating, cover etc. - all of them are configured by hourly ranges (see example). This allows me to change something (target temperature, cover close/open) in between, the target state of the schedule is only executed if the new time slot is reached. But on midnight 0:00 every day, all daily schedules are triggered even if the target state between the previous day 23:59 and the current day 0:00 does not differ. This results in the fact that all manual actions changes in between are overwritten (e. g. all covers moving to the scheduled position at midnight).

Would it be possible to add a flag to a schedule that on the schedule start time (00:00) no action is triggered if the previous and the current target state does not differ?

Additional info

grafik

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

LinusHoppe commented 1 year ago

@nielsfaber Any ideas?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Nightenom commented 1 year ago

I suffer the exactly same issue, ideally no action should be taken at midnight, but at least if this could be removed from ui, so if next change happens tomorrow at 5 am, then it shows 5 am and not midnight

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Nightenom commented 1 year ago

Still an issue

nielsfaber commented 1 year ago

By design the schedules last from 00:00 to 23:59, so if a schedule has an action assigned to the first timeslot (starting at 00:00), there will be an action triggered at midnight.

It is not really possible to change the daily repetition cycle (i.e. creating a single timeslot spanning over multiple days) this would also complicate a lot of things in both the card and the integration.

I also don’t really see a straightforward way how to determine whether a scheduled action ‘has no effect’ and thus a timeslot could be skipped. Since scheduler supports all kind of entities, a lot of logic (per entity type) would have to be implemented to compare the current state with what the state would become after performing a certain action.

In summary, I agree it would be nice if scheduler could automatically skip timeslot transitions which have no effect, but a large amount of effort would be needed to implement it and there is not really any functional benefit (other than the next displayed time in the card being more meaningful).

Nightenom commented 1 year ago

I completely agree with your reasoning, which brings up a simple question: could you just detect this in ui and adjust the rendering accordingly? Personally I think it's just simple value comparison regardless the entity type

Edit: if it's hard, maybe a hidden checkbox to ignore midnight transition would work?

nielsfaber commented 1 year ago

@Nightenom the calculation of the next timeslot is performed in the integration side. The card only visualizes this info. Hence it is definitely not possible to implement this feature on the UI side.

Nightenom commented 1 year ago

Sorry for misunderstanding, but I didn't mean logic change, just visual info, because my relatives are PC antitalents, so they are confused by the displayed info about task

I noticed that OP wants logic change

I'm currently using no-state as first block of the day, but it's not ideal

github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days