This might need to be a feature request, but thought that I would check here first in case I overlooked something.
Is there a way to to resume a timer or all the timers after rebooting/restarting Home Assistant? I have some timers that will be set for a number of hours. If I am developing other Automations or Configurations in YAML and I need to restart home assistant to apply the changes, I want my timers to continue where they left off. It’s ok if the timer is delayed during the time the HA took to restart, but I guess it would be ideal if that was taken into account as well.
Right now what happens when a timer is set, the countdown begins. If HA is restarted during the timer execution, the timer is reset and since the duration
is set by a template and there is no default value there is no timer duration set.
I can see that I could manually implement this by having an automation that records the current time remaining in the timers, pauses the timer, and at HA start, it sets the duration to the saved time and starts the timer… but this could cause issues if their is an associated automation based on the timer starting and it seems like there should be a more elegant solution. Another option might be to create a custom-component that saves the timestamp of when the timer should be finished
and restores the state of the timer at boot by restoring the remaining
(to_finish_timestamp
- now().timestamp
) and the state (active
, idle
, paused
, etc.)
Anyone know of a better or simpler solution?
Solutions:
@123 Came up with a solution that works with the built in Home Assistant timer. See the solution here: Resume timers after reboot
@gremblin Came up with a solution by editing the Home Assistant timer component. This needs to be installed in custom_components
and overrides the built in Home Assistant timer. See the solution here: Resume timers after reboot