Automation is not trigging - Will run manually

I’ve got a sensor for my garage door that reports open/closed conditions.

I’ve tried to set up an automation that will send a message if the door has been left open.

I’m pretty sure there must be something going on with how I have the automation configured because if I run it manually it works and sends the alert. If I just let things ride the automation never fires off even if I open the door and leave it open beyond the 10 minute threshold.

Here is the automation:

alias: Garage Door - Test
description: Test Alert
trigger:
  - type: opened
    platform: device
    device_id: 97a8a44c2cfbce71741adf87c3f6c9eb
    entity_id: 83dee3563e5b17067ce23976036d1f2b
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition:
  - type: is_open
    condition: device
    device_id: 97a8a44c2cfbce71741adf87c3f6c9eb
    entity_id: 83dee3563e5b17067ce23976036d1f2b
    domain: binary_sensor
    for:
      hours: 0
      minutes: 10
      seconds: 0
action:
  - service: notify.mobile_app_glens_iphone
    metadata: {}
    data:
      message: Glen's garage door is open
mode: single

I didn’t know how to copy the automation other than copying the code.

I’m not sure why opening the door would not fire off the automation. There was one item on the “When” section of the config. That is “Duration.” Device and trigger seem straightforward but the duration seems confusing.

If I understand it correctly the “And” section is where I’m setting the open duration. I have it set for “And if” the door is open for 10 minutes… it should “Then do”

If someone could point me in the right direction I would appreciate it.

Thanks in advance.

Here’s what you have created:

Trigger: When door opens
Condition: Door has been open for more than 10 minutes

The condition doesn’t wait for the door to remain open for 10 minutes, it checks if it has been open for 10 minutes. Obviously that can never happen because the door just opened microseconds before the condition is tested.

Use a State Trigger with its for option set to 10 minutes. Remove the Device Condition.

alias: Garage Door - Test
description: Test Alert
trigger:
  - platform: state
    target:
      entity_id: binary_sensor.your_door
    from: 'off'
    to: 'on'
    for:
      minutes: 10
condition: []
action:
  - service: notify.mobile_app_glens_iphone
    metadata: {}
    data:
      message: Glen's garage door is open
mode: single

EDIT

Correction. Overlooked to include from and to options.

2 Likes

Perfect.

Thanks.

So syntax was not the problem but the trigger type.

I appreciate your assistance.

1 Like