WTH keep for part in automation alive while restarting HA

If I have a trigger like this.

  trigger:
  - platform: device
    type: turned_on
    device_id: 30acf7e150eb4818243709b045f8b34e
    entity_id: switch.lamp_trapkast
    domain: switch
    for:
      hours: 2
      minutes: 10
      seconds: 0

but during those 2 hours HA get’s restarted, the trigger won’t fire.
I can fix this using input_datetime but this is in my opinion to complicated.
Automation actions(also delay btw) should be kept alive during the restart.

What happens if Home Assistant is offline longer than the for: time?

good question,
maybe it should be a setting to either cancel, or continue the automation at this point.
in my example, the light should be turned of anyway, but I can imagine that some users want different behavior.

also, what should happen if the specified automation is modified in the meanwhile?
I think at that point the automation should stop, but maybe it’s better not to this is something to consider and I don’t have a straight answer for it.

FYI, the for time used to survive reloading/restarting. It was a deliberate change, but I am not sure of the reasoning.

1 Like