Delay inside automation stopped working

No changes to the automation itself, only HA update to the latest. Motion detection is turning on two switches as expected but the automation never seems to complete the 15 minute delay and turn those switches off.

description: Philips motion sensor used to turn all front porch lights on
trigger:
  - type: motion
    platform: device
    device_id: 58cdd7e066ed59250e9630fdb5e52242
    entity_id: binary_sensor.philips_outdoor_motion_sensor_a_occupancy
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition:
  - condition: numeric_state
    entity_id: sensor.philips_outdoor_motion_sensor_a_illuminance_lux
    attribute: illuminance_lux
    below: "500"
action:
  - service: persistent_notification.create
    data:
      message: Motion detected in front porch; turning lights on
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
        - switch.treatlife5_2
        - switch.front_porch_lights
  - delay:
      hours: 0
      minutes: 15
      seconds: 0
      milliseconds: 0
  - service: persistent_notification.create
    data:
      message: Motion activated lights turned off
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.treatlife5_2
        - switch.front_porch_lights
mode: single

Did the use of “delay” change?

Thanks

As I understood, your lights are turning on as expected, but are turning off earlier than expected, is that right? No other automation turning the lights off?

What about your logs? Can’t you find anything related to this automation?

Try this:

description: Philips motion sensor used to turn all front porch lights on
trigger:
  - type: motion
    platform: device
    device_id: 58cdd7e066ed59250e9630fdb5e52242
    entity_id: binary_sensor.philips_outdoor_motion_sensor_a_occupancy
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 1
condition:
  - condition: numeric_state
    entity_id: sensor.philips_outdoor_motion_sensor_a_illuminance_lux
    attribute: illuminance_lux
    below: "500"
action:
  - service: persistent_notification.create
    data:
      message: Motion detected in front porch; turning lights on
  - service: switch.turn_on
    data: {}
    target:
      entity_id:
        - switch.treatlife5_2
        - switch.front_porch_lights
  - delay: 900
  - service: persistent_notification.create
    data:
      message: Motion activated lights turned off
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.treatlife5_2
        - switch.front_porch_lights
mode: single

Actually they are not turning off. I did not realize that logs were kept for the automation and the last one shows a cancellation 10 minutes into the automation even though I did not do anything manually and the delay was for 15 minutes.

What could have caused the cancellation?

When you edit one automation and save it all of your automations are stopped and then reloaded. If you are currently playing with automations I bet this is the cause.

Good to know.

I did open the automation but only because the lights had not turned off after about an hour. I will do some controlled experiments tomorrow.

Thanks.

Have a look at the automations.yaml, when was the file last saved?
I would think 09:37

Take a look at Settings > System > Logs and look for something related to this automation. It might be something else broken.

By the way, I would consider changing the mode to “restart” so your lights won’t turn off while the moviment persists.