What happens to a "Delay for ..." if HA is rebooted?

I have an automation with several actions & delays, ie

When the time is equal to 7:00 Then do xxx
Delay for 30:00 Then do yyy
Delay for 1:30:00 Then do zzz

Will yyy and zzz action if I re-boot the HA server at say, 8:00? If not, what would be the tidiest way to achieve what I want?

Many thanks!

When you reboot/restart Home Assistant, any automations that are busy processing their actions (delay, wait_template, repeat, etc) are terminated. After startup, the automation does not resume from the point where it was terminated.

Depends on the application’s purpose. It may be possible to redesign the automation to avoid using delay, perhaps with a timer.

Post your automation.

Many thanks, @123 This light should come on for a period in the morning, then again in the evening;

I could do two automations, but I was keen to try to reduce the number by combining morning and evening activities where possible.

alias: Lights - Bridge
description: ""
trigger:
  - platform: time
    at: "07:00:00"
condition: []
action:
  - service: light.turn_on
    metadata: {}
    data:
      brightness: 50
    target:
      entity_id: light.bridge
  - delay:
      hours: 0
      minutes: 30
      seconds: 0
      milliseconds: 0
  - service: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.bridge
  - delay:
      hours: 1
      minutes: 30
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    target:
      entity_id: light.bridge
    data: {}
  - delay:
      hours: 9
      minutes: 0
      seconds: 0
      milliseconds: 0
  - service: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.bridge
  - delay:
      hours: 4
      minutes: 0
      seconds: 0
      milliseconds: 0
  - service: light.turn_on
    metadata: {}
    data:
      brightness: 20
    target:
      entity_id: light.bridge
  - delay:
      hours: 1
      minutes: 15
      seconds: 0
      milliseconds: 0
  - service: light.turn_off
    target:
      entity_id: light.bridge
    data: {}
mode: single

I suggest you simply use Time Triggers with a variable to specify the light’s brightness (0 is off).

alias: Lights - Bridge
description: ""
trigger:
  - platform: time
    at: "07:00:00"
    variables:
      level: 50
  - platform: time
    at: "07:30:00"
    variables:
      level: 100
  - platform: time
    at: "09:00:00"
    variables:
      level: 0
  - platform: time
    at: "18:00:00"
    variables:
      level: 100
  - platform: time
    at: "22:00:00"
    variables:
      level: 20
  - platform: time
    at: "22:00:00"
    variables:
      level: 0
condition: []
action:
  - service: light.turn_on
    data:
      brightness: '{{ level }}'
    target:
      entity_id: light.bridge
mode: single

It’s easier to maintain the automation, such as when you want to re-schedule a specific turn on/off time, and it’s far less vulnerable to failures caused by restarting Home Assistant. This version is vulnerable only if Home Assistant is in the process of restarting at one of the 6 scheduled times. There are ways to mitigate that as well.


NOTE

You could simply use a trigger’s id to hold the desired brightness value but I chose to use a trigger variable just to demonstrate its capabilities.