Automation to send a Notification if door1 and door2 is open for more than 5 minutes

Hi Guys,

I am trying to create this automation:

WHEN
Door1 and Door2
ARE
open both open for 5 minutes
THEN
Send a notification

However I am not sure how to AND door1 and doo2 in the automation

Thanks Guys!

alias: Alert if both garden door open for x minutes
description: ''
trigger:
  - type: opened
    platform: device
    device_id: be92caa1d878yughgu7t8767
    entity_id: binary_sensor.garden_sliding_door_contact
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - type: opened
    platform: device
    device_id: 85ae84c391a7978787087098yiu7
    entity_id: binary_sensor.garden_screen_door_contact
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
condition: []
action:
  - service: notify.notify
    data:
      message: Both doors are open
mode: single

You can use the state in the condition as you have used in the trigger.
Use AND condition.

You need to view this more different. :slight_smile: :astonished:

A trigger is something that “starts” your automation, in your case the opening of the door. The next step, to check if both doors are open for x minutes, is what you need as a condition. Will say, something that is a trigger can be as well a condition. :slight_smile:

alias: Alert if both garden door open for x minutes
description: ''
trigger:
  - type: state
    entity_id: binary_sensor.garden_sliding_door_contact
    to: 'open'
    for:
      minutes: 5
  - type: state
    entity_id: binary_sensor.garden_screen_door_contact
    to: 'open'
    for:
      minutes: 5
condition:
  condition: and
  conditions:
    - condition: state
      entity: binary_sensor.garden_sliding_door_contact
      state: 'open'
      for: 
        minutes: 5
    - condition: state
      entity: binary_sensor.garden_screen_door_contact
      state: 'open'
      for: 
        minutes: 5
action:
  - service: notify.notify
    data:
      message: Both doors are open
mode: single

I’m actually not sure, if the five minutes in the condition are really necessary, but it shouldn’t do any harm either… :slight_smile:

As I see, I’m a little late to the party, but writing the example takes time. :rofl: :rofl: :rofl:

Edit: have to take some words back.
If no time in the condition then action will run if both doors happen to be open.
If condition has time set then will run action if the door was actually open for 5 minutes.

I would not say late to the party but more thorough :slight_smile: