nielsfaber / scheduler-component

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

Schedules are turned off or not triggering #352

Closed Marvin3241 closed 2 months ago

Marvin3241 commented 5 months ago

Checklist

Card Version

v3.2.13

Component Version

No response

Bug description

My schedules are often turned off after triggering. For example, I have a schedule that should trigger 3 or 4 times during the day but after the first trigger it turns itself off. Sometimes the schedule is not turned off, but it will say show that it is finished for the day and it will be waiting for the next schedule to trigger. Here you can see the lowest schedule is turned off. This happened after it triggered. WhatsApp Image 2024-04-16 at 19 29 22 Here you can see that there are still triggers planned for the day, but these won't be happening. WhatsApp Image 2024-04-16 at 19 29 23

Steps to reproduce

To reproduce I created an input_number in the home assistant helpers and created a schedule with this number. I added multiple days to the schedule and set multiple triggers for each day. After the first trigger, the problem already occured.

Additional info

No response

simonhills commented 5 months ago

I have a very similar issue, which is really rather annoying as I use this to schedule my heating!

I'm my case the schedule always stays on, but it does not apply new updates to the climate entities after 1 day. The schedule is set to repeat.

DeniTCH commented 5 months ago

I am also experiencing a similar issue. I have a schedule that sets a number helper for adjusting a certain lights brightness value throughout the day. It used to work fine but now it seems that it is only triggered once, and never again.

Farmer-Eds-Shed commented 5 months ago

Seeing the same issue here, since last HA update 2024.4.3. I've since update the scheduler component also.

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:957
First occurred: April 24, 2024 at 6:50:00 PM (8 occurrences)
Last logged: April 24, 2024 at 6:50:00 PM

Entity switch.schedule_hw_boiler (<class 'custom_components.scheduler.switch.ScheduleEntity'>) is using self.async_update_ha_state(), without enabling force_refresh. Instead it should use self.async_write_ha_state(), please create a bug report at https://github.com/nielsfaber/scheduler-component/issues
Entity switch.schedule_saturday_hot_water_set_to_65 (<class 'custom_components.scheduler.switch.ScheduleEntity'>) is using self.async_update_ha_state(), without enabling force_refresh. Instead it should use self.async_write_ha_state(), please create a bug report at https://github.com/nielsfaber/scheduler-component/issues
Entity switch.schedule_switch_to_sensor_lights (<class 'custom_components.scheduler.switch.ScheduleEntity'>) is using self.async_update_ha_state(), without enabling force_refresh. Instead it should use self.async_write_ha_state(), please create a bug report at https://github.com/nielsfaber/scheduler-component/issues
Entity switch.schedule_disable_sensor_lights_dawn (<class 'custom_components.scheduler.switch.ScheduleEntity'>) is using self.async_update_ha_state(), without enabling force_refresh. Instead it should use self.async_write_ha_state(), please create a bug report at https://github.com/nielsfaber/scheduler-component/issues
Entity switch.schedule_lights_on_sunset (<class 'custom_components.scheduler.switch.ScheduleEntity'>) is using self.async_update_ha_state(), without enabling force_refresh. Instead it should use self.async_write_ha_state(), please create a bug report at https://github.com/nielsfaber/scheduler-component/issues
rssluca commented 5 months ago

+1

Swiiney commented 5 months ago

I think I have the same problem here. My schedule are not always triggered for my heating... Hopefully we are in spring 😉

sddgit commented 5 months ago

Is this problem affecting any type of schedule/entity for you guys? I’m keen to update HA to the latest version, but not if Scheduler is affected. I’m just too reliant on it!

Marvin3241 commented 5 months ago

Is this problem affecting any type of schedule/entity for you guys? I’m keen to update HA to the latest version, but not if Scheduler is affected. I’m just too reliant on it!

It's not affecting the schedules I have for my A/C units it seems. They are still running fine. I haven't tested it on anything other than the input_number helper, so I'm not sure if anything else is affected at this moment. Maybe if you could share the setup of your schedule I can give it a try.

AppleFlapp commented 5 months ago

Same/similar story here. Today a scheduled task works but it doesn't do the next day. Unless I have restarted HA or toggled the scheduled task manually inbetween.

Did already change from daily to choose (all days) but no difference. Even removing the repository and reinstalling it didn't solve the issue.

Very annoying when you expect that your covers will open/close automatically.

Farmer-Eds-Shed commented 5 months ago

Same/similar story here. Today a scheduled task works but it doesn't do the next day. Unless I have restarted HA or toggled the scheduled task manually inbetween.

Did already change from daily to choose (all days) but no difference. Even removing the repository and reinstalling it didn't solve the issue.

Very annoying when you expect that your covers will open/close automatically.

That's the same as I'm having. I've setup an automation to toggle the schedules on/off after midnight every day to keep things running until a proper solution can be implemented, it's obviously not ideal but works. (it may be easier to schedule a restart either)

All my schedules are set to trigger once on the given day and I don't use the scheme option at all so not sure how they are affected.

AppleFlapp commented 5 months ago

@Farmer-Eds-Shed what is the benefit of the Scheduler card then if you need an automation to toggle the schedules? Then you can also build the automations to do the scheduling without using the Scheduler card.

Btw, I think the problems started around the time Europe was changing DST or the HA core/supervisor built following that.

Farmer-Eds-Shed commented 5 months ago

@Farmer-Eds-Shed what is the benefit of the Scheduler card then if you need an automation to toggle the schedules? Then you can also build the automations to do the scheduling without using the Scheduler card.

Btw, I think the problems started around the time Europe was changing DST or the HA core/supervisor built following that.

It's not a proposed fix, just an interim workaround but the benefit is:

Read the post, I said it's obviously not ideal

sddgit commented 5 months ago

Is this problem affecting any type of schedule/entity for you guys? I’m keen to update HA to the latest version, but not if Scheduler is affected. I’m just too reliant on it!

It's not affecting the schedules I have for my A/C units it seems. They are still running fine. I haven't tested it on anything other than the input_number helper, so I'm not sure if anything else is affected at this moment. Maybe if you could share the setup of your schedule I can give it a try.

Thank you for the offer. My most importaint schedules just involve shemes that turn switches on and off a number of times each day. Simple stuff really.

AppleFlapp commented 5 months ago

@Farmer-Eds-Shed no need to be so defensive. I never said is was your fault. Just mentioning that with using automations to keep the Scheduler card/repository working the Scheduler does loose a lot of its added value. That has nothing to do with your workaround.

nielsfaber commented 5 months ago

I haven't seen any issues with a schedule not triggering or disabling itself myself. In my setup I use multiple schedules that trigger on a daily basis, so any broken functionality would be noticed. There are no significant changes made to this component in over a year, so I have no idea what causes this recent issue (this is likely introduced by changes in HA).

If anyone has some reproduction scenario or error logs that could help identifying the issue, please share. For those who want to contribute: it may be useful to install the profiler integration and call service profiler.set_asyncio_debug (with enabled=true) to increase the likelihood of the problem occuring and catching the issue in the HA error logs.

Farmer-Eds-Shed commented 5 months ago

@Farmer-Eds-Shed no need to be so defensive. I never said is was your fault. Just mentioning that with using automations to keep the Scheduler card/repository working the Scheduler does loose a lot of its added value. That has nothing to do with your workaround.

?? You asked a question on what benefit, and I simply answered. Obviously it was just a temporary workaround, regardless of loosing value or not I still need my hot water schedule to work even if it's in a baling twine and pallets sort of way. Others here may be in a similar predicament easy to remove the addition when all is fixed.

I didn't think you were assigning blame at all.

Farmer-Eds-Shed commented 5 months ago

If anyone has some reproduction scenario or error logs that could help identifying the issue, please share. For those who want to contribute: it may be useful to install the profiler integration and call service profiler.set_asyncio_debug (with enabled=true) to increase the likelihood of the problem occuring and catching the issue in the HA error logs.

I'm running that now on my instance

Farmer-Eds-Shed commented 5 months ago

Maybe this is useful? Schedule triggered at 4:30 but next trigger time is showing as 4 min ago

Logger: homeassistant.util.logging
Source: util/logging.py:103
First occurred: 4:30:00 PM (1 occurrences)
Last logged: 4:30:00 PM

Exception in async_timer_finished when dispatching 'scheduler_timer_finished': ('396d91',) Traceback (most recent call last): File "/config/custom_components/scheduler/switch.py", line 258, in async_timer_finished await self._action_handler.async_queue_actions( File "/config/custom_components/scheduler/actions.py", line 258, in async_queue_actions for queue in self._queues.values(): RuntimeError: dictionary changed size during iteration

image

AppleFlapp commented 5 months ago

Let me guess what happens next: Tomorrow it shows "yesterday" instead of 4 minutes ago or any other expected update on the status and even if it is then 4:35 nothing has happened.

That is about what happens here for the daily open/close schedules of my covers.

Only a toggle of the schedule will bring the configured schedule back alive.

nielsfaber commented 5 months ago

@Farmer-Eds-Shed

Maybe this is useful? Schedule triggered at 4:30 but next trigger time is showing as 4 min ago

Are you sure you are running the latest version? I thought this error was adressed a while ago, see: https://github.com/nielsfaber/scheduler-component/issues/343

deveon95 commented 5 months ago

I'm here because I have the same problem...

My software versions on the Pi 5 are:

I will check what the versions are on the Pi 3 SD card and report back.

deveon95 commented 5 months ago

I forgot to mention that in my case, if a schedule is turned off, then the displayed time that it would run next if it were turned on is updated correctly.

The Pi 3 SD card has:

I disabled automatic updates so that I could manually update each component and see which one breaks it.

With the above versions, I set a schedule to run a script in a few minutes with daily repeat enabled, and the time updated as expected.

I then updated Home Assistant Supervisor to 2024.04.4, repeated the experiment, and again the time updated as expected.

Next, I updated the Home Assistant Operating System to 12.2, repeated the experiment, and again the time updated as expected.

After that, I updated Home Assistant Core to 2024.5.0, which had just come out, and the time has not updated (it shows as 3 minutes ago, etc.) and probably won't repeat tomorrow, so the fault is caused by a change to Home Assistant Core and the version which introduced the fault was something between 2024.3.0 and 2024.4.4 inclusive, remembering that the installation on the Pi 5 has the problem with 2024.4.4.

Farmer-Eds-Shed commented 5 months ago

@Farmer-Eds-Shed

Maybe this is useful? Schedule triggered at 4:30 but next trigger time is showing as 4 min ago

Are you sure you are running the latest version? I thought this error was adressed a while ago, see: #343

@nielsfaber I was sure I was, as I updated through hacs last week. However I'm after reinstalling the component and card and it looks to be working as expected now. I'll report back if I still have an issue later. Thanks.

AppleFlapp commented 5 months ago

@Farmer-Eds-Shed @nielsfaber I did a full removal and reinstall of the component and card last week without success. Maybe only one time that it worked as expected but that could also be the first time when it always succeeds similar like when you toggle the schedules.

Farmer-Eds-Shed commented 5 months ago

@Farmer-Eds-Shed @nielsfaber I did a full removal and reinstall of the component and card last week without success. Maybe only one time that it worked as expected but that could also be the first time when it always succeeds similar like when you toggle the schedules.

Maybe @AppleFlapp, but they ran this morning and are showing next execution as tomorrow instead of in the past. But time will tell.

nielsfaber commented 5 months ago

In an attempt to reproduce the issue, I created a schedule which changes an input_number entity 3 times per day (similar to the original problem description by @Marvin3241 )

I will check the history of the entity in a couple of days to see if any actions are missed. If anyone has a better idea, please let me know.

deveon95 commented 5 months ago

It's possible to downgrade Home Assistant Core using ha core update --version x.y.z so I've tried this to narrow down which version of the core stopped the scheduler from working properly.

2024.4.0 - affected; schedules only run once

2024.3.3 - not affected; Scheduler works normally

Downgrading to 2024.3.3 can be used as a temporary fix until someone figures out exactly what change in Home Assistant Core is causing the problem.

AppleFlapp commented 5 months ago

@deveon95 Great finding. This was also something I was expecting that it might have to do with new HA core version.

Only thing is that the workaround from @Farmer-Eds-Shed is easier to implement and has less risk compared to downgrade HA.

nielsfaber commented 5 months ago

My testing schedule as described here has been running for a few days now, I have not been able to reproduce the reported issue.

As shown below, the schedule triggers correctly at the programmed times, no occurences are skipped. image

sddgit commented 5 months ago

What HA version are you running @nielsfaber ?

pyrosteve commented 4 months ago

FWIW I started seeing this problem with schedules that had been working reliably for many months after upgrading to HA Core 2024.4.3 For me, the problem seems to have been fixed by updating scheduler-component to 3.3.3 in HACS

sddgit commented 4 months ago

Anyone have any further thoughts on this? I’m still hesitant to update HA in case my schedules break.

pdcastro commented 4 months ago

Anyone have any further thoughts on this? I’m still hesitant to update HA in case my schedules break.

Yes, a couple. First, some users are still reporting this issue in May 2024 while using old versions of scheduler-component such as version 3.3.0 of January 2024. If you are still facing this issue, be sure to upgrade the scheduler-component and scheduler-card to the latest versions. Upgrading may not solve the problem, but at least it will clarify whether or not the code changes made by the maintainer have helped or not (in particular the fix released in scheduler-component v3.3.3).

A second thought is that this issue only affects a subset of users, for some reason. For one, I have not been affected with the following combinations:

I use a HA Core Container installation (Docker on Ubuntu Server, decade-old Intel Core i5 laptop). I have 34 scheduled entities repeating on different days of the week and calling the following services:

I have not observed any missed scheduler trigger, or any self turn off. One thing though: I have configured my scheduler cards with the option “Configured time for next action” rather than "Time remaining until next action" as shown in the screenshot below, which means that my cards show something like “At 4:00 Every Monday and from Wednesday to Friday” and they would not show something like “‘yesterday’ instead of 4 minutes ago”. Still, I would have noticed a cold water shower if the scheduler had stopped heating the water, for example. 😅

Screenshot 2024-05-15 at 13 41 50
deveon95 commented 4 months ago

It looks like @pdcastro is on to a winner and the fix was already done in one of the later issues of scheduler-component. I upgraded to 2024.4.0 specifically because I knew that version didn't work, then upgraded scheduler-component to the latest and now it's working fine. The developer couldn't reproduce the fault because they had already fixed it and were on the latest version.

So what's the lesson... just because everything is up to date under 'Settings' does not mean that everything is up to date under HACS so go there and check.

It's also a good reminder of why it's important to post version numbers of every relevant part of the system. Of course that works better when others then scrutinize those versions and point out when one isn't up to date.

sddgit commented 4 months ago

Thanks for the thoughts. I reckon I’ll update HA now!

RogMoe commented 3 months ago

I'm having the same issue.

Scheduler 3.3.3 Core 2024.6.0 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240605.0

If I open the schedule, save and close, it sems to wake up en perform the forgotten action (no editing done). I use the scheduler to set different ventilation modes.

scheduler

github-actions[bot] commented 2 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