Ensure that automations revert to their last state after a restart #3978
-
Describe the featureEvery time Home Assistant restarts, automations stop completely. When there is a scheduled trigger, this can cause problems such as a module failing to stop at the desired time, etc. Use casesI set my water heaters to start heating at 10 pm and stop at 6 am. If Home Assistant restarts or there is a power cut, the automation stops completely and my water heaters do not switch off at 6 am Current workaroundsNo response Anything else?No response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
How did you set up your automation? Do you trigger at 10pm, and then you let the automation wait until 6am using a delay? Example: triggers:
- alias: Trigger when the water heater should turn on or off based on time
trigger: time
at:
- "06:00"
- "22:00"
- alias: Trigger when Home Assistant starts
trigger: homeassistant
event: start
actions:
- alias: Check which action is required
if:
- alias: Time block the water heater should be on
condition: time
after: "22:00"
before: "06:00"
then:
- alias: Turn the water heater on
action: switch.turn_on
target:
entity_id: switch.water_heater
else:
- alias: Turn the water heater off
action: switch.turn_off
target:
entity_id: switch.water_heater |
Beta Was this translation helpful? Give feedback.
-
|
@TheFes has provided a great example of how to set up your automations to be more resilient, however it is absolutely a known issue that some elements of automations just do not survive restarts or reloads. It's a need I'd like to track in one place: #3791. Feel free to add your support and other examples, if you have any, there. Thanks! |
Beta Was this translation helpful? Give feedback.
@TheFes has provided a great example of how to set up your automations to be more resilient, however it is absolutely a known issue that some elements of automations just do not survive restarts or reloads. It's a need I'd like to track in one place: #3791. Feel free to add your support and other examples, if you have any, there. Thanks!