Automation: Make state reboot-persistant (similar to initial_state)

Hi,

I have an automation that closes my curtains every day at 10pm. Now in summer I often have the window open so I don’t want that automation to be on all the time. Basically, I could just turn it off in the interface, right?
Unfortunately I can’t as the raspberry pi reboots itself once a day to avoid some wifi instability issues. After the night’s reboot however, the automation switches itself on. I don’t want to switch it of every day and I don’t want to set an initial_state because I believe the problem should/can be solved more elegantly.

Any ideas how to make automation state (on/off) persistant over reboots of Home-Assistant?

Thank you for your input :slight_smile:

There’s a few ways you could do this but the easiest will to have a condition with an input_boolean. This way you can control from the front end. The input_booleans state should survive a reboot.

The other way is more complex but you could have a condition that runs when the month is a summer month and the temperature is over a certain threshold and the AC is not on. That sort of thing.

Let me know if you need help writing it.

I believe the on/off state of automations is saved across restarts just like the state of other entities (assuming, like other entities, you haven’t set an initial state in the config.) At least they do for me. I wonder if your issue is the way the system is rebooting. Are you sure it’s gracefully shutting down HA before rebooting? If not, then HA may not have a chance to save states.