Trouble about automation on trigger time

Hi to all,
let’s say I have an automation that at 16:00:00 set climate.set_temperature at 21°.

What if, for any reason, server is shutdown / rebooting / homeassistant is down at 15:59:00 and at 16:01:00 it returns available?

Automation will not be fired anymore until next 24h?

Thank you

That’s correct.

Thank you. Other than using “before” and “after”, is there a method to be sure that an automation is triggered for sure?

Don’t turn off your homeassistant system.

2 Likes

Make sure your server doesn’t randomly restart (I can’t remember when my server ever restarted without me requesting it.

1 Like

Well… can be a SD crash, an update to a config… Btw, thank you for the advice :slight_smile:

Yes, that’s why I switched to something with an SSD years ago.

But that doesn’t happen without you interacting with the machine.

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…

Thank you for your other point of view… I’ll think about it :wink:

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.