Garage Notification Automation Assistance

I’ve been trying to get this automation to work for over three weeks now with no success. It contains one trigger and two actions, the first action executes good as soon as the trigger changes state but the second action never executes after the time has elapse. I’m hoping that someone can give me some pointers on where my problem lies.

alias: Single Garage Door Notify Open
description: ""
trigger:
  - type: opened
    platform: device
    device_id: ddc1bcc49020530900a4ee5539851cb4
    entity_id: 5ca45770c7b611f84d749b54eae1811c
    domain: binary_sensor
condition: []
action:
  - data:
      message: Single Garage Door Open!
      title: WARNING
    service: notify.mobile_app_galaxy_s22_ultra
  - if:
      - condition: state
        entity_id: binary_sensor.single_garage_door_contact
        state: "on"
        for:
          hours: 0
          minutes: 1
          seconds: 0
    then:
      - service: notify.mobile_app_galaxy_s22_ultra
        metadata: {}
        data:
          message: Single Garage Door Left Open!
          title: WARNING
mode: single

Conditions do not wait… the condition of the If is being checked almost immediately after the trigger, so the sensor will only have been ‘on’ for a a couple milliseconds, not 1 minute.

You need to use a Wait action or restructure your automation.

If the trigger device is identical with binary_sensor.single_garage_door_contact , I’d use 2 state triggers instead:


trigger:
  - id: warn1
    platform: state
    entity_id: binary_sensor.single_garage_door_contact
    from: 'off'
    to: 'on'
  - id: warn2
    platform: state
    entity_id: binary_sensor.single_garage_door_contact
    from: 'off'
    to: 'on'
    for:
      minutes: 1
action:
  - service: mobile_app_galaxy_s22_ultra
    data:
      title: WARNING
      message: Single Garage Door {{ 'left' if trigger.id == 'warn2' else '' }} Open!

    

Thank you for this suggestion. It solve my faulty attempt. Now it would be nice to make it a persistent notification until the door gets close.