I have a long running automation to turn of my heater when the indoor temperature is above a value for 2 days. Unfortunately this does not work, when home assistant is restarted during this time. How can I solve this?
@AlbertMaier
If you use arnedad’s suggestion, keep in mind that when a timer is restored after a restart, its new duration is reduced by the amount of time Home Assistant took to restart. For example, if there’s a power failure and Home Assistant is inoperative for an hour, when it restarts the timer’s new duration will be reduced by 1 hour. In other words, the amount of downtime is deducted from the timer’s countdown when it’s restored on startup.
I will normally go the timer route too, because I’d like to see the remaining time, but in this case I’m not sure it is even useful.
This, another option is to set an input_datetime helper in your automation with this future time when conditions are met, and then make a second automation with a time trigger that will trigger at the time of the input_datetime (use it in the at: of a time trigger). In the first automation you remove the for: and only have an action to set the helper. In the second automation, you turn off the heating.