I have evolved a fairly complicated “comfort control” system using HA. WIthout going into all the details, I ended up creating an automation that I can trigger with an input_boolean. The automation sets the thermostat based on all the other rules I’ve established. I ended up all that logic into a python_script. It sets the thermostats based on whether or not we’re home, time of day (I have the day split into several chunks of time), etc.
But… that still takes me toggling the input_boolean to get the thermostats to “reboot” (they don’t really reboot, that’s just what I’m calling it). I’m now thinking I could toggle that input_boolean to on in an automation that runs whenever HA starts up. That might be an option for you. It would look something like this:
###################################################
# Startup settings #
# #
###################################################
- alias: Do this on hass.io startup
trigger:
- platform: homeassistant
event: start
action:
# After a short delay, reboot the HVAC settings after a restart
- delay: '00:02:00'
- service: input_boolean.turn_on
data:
entity_id: input_boolean.reboot_hvac_settings
- delay: '00:00:05'
# After another VERY short delay, turn the input_boolean to 'off'
- service: input_boolean.turn_off
data:
entity_id: input_boolean.reboot_hvac_settings
I don’t really like using a delay, so I’ll probably implement this with a couple of timers when it gets to the top of my priority list. Or, even better, one timer to trigger the boolean to turn on and then turn it off as the first service in the reboot automation.
But (again), I don’t see that happening very often - if the SD card crashes, I’ve got bigger problems than setting a thermostat… And @Burningstone now has me thinking about an SSD…
I think the easiest way to ensure an errant or poorly timed restart doesn’t cause an issue is to just configure another trigger at some time later…say 10 minutes, enough time for a full restart…that will try to set the temp again. If the temp is already set by the first time trigger then nothing will happen. If its not then it will ensure the temp is set correctly, just 10 minutes later.