Automation Not Working as Intended - 2 Contact Sensors Closed for 1 Minute

Hello,

I am new to HA but I’ve gotten unbelievably far on this journey on my own. I’m having trouble with what I consider to be a simple automation and I’ve tried a few different things to make this work.

I just want an automation to run when two doors have been closed for 1 minute and conversely when they are opened for two minutes.

The way this is written, it gets treated like an or statement and either one of the doors closing is causing the automation to fire.

- id: '1641139351874'

  alias: House Awake - False

  description: ''

  trigger:

  - type: not_opened

    platform: device

    device_id: 253da192a574953187a6ffa226818201

    entity_id: binary_sensor.bedroom_2_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 2

      seconds: 0

  - type: not_opened

    platform: device

    device_id: b1c35c134c59dd8979a12b3c488e301e

    entity_id: binary_sensor.bedroom_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 2

      seconds: 0

  condition: []

  action:

  - service: script.air_filters_five

  - service: light.turn_off

    target:

      entity_id:

      - light.all_exterior_lights

I tried some defensive conditions where it would only fire if both doors were closed which worked but I am CONVINCED that’s not the right way to do it. I know this is something incredibly simple that I’m missing. I’ve gone round and round in tutorials and videos on something so elementary and I still can’t get it to work like I think it should.

Can somebody take a look and tell me what I’m doing wrong?

Conditions are the right way to do it.
Triggers need to be independent otherwise it would require both events to happen at the exact same time.
You can also create a group for the contacts if you prefer.

Alright, I put it all back. I guess I was just overthinking it. Thanks

- id: '1641139351874'

  alias: House Awake - False

  description: ''

  trigger:

  - type: not_opened

    platform: device

    device_id: 253da192a574953187a6ffa226818201

    entity_id: binary_sensor.bedroom_2_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 1

      seconds: 0

  - type: not_opened

    platform: device

    device_id: b1c35c134c59dd8979a12b3c488e301e

    entity_id: binary_sensor.bedroom_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 1

      seconds: 0

  condition:

  - type: is_not_open

    condition: device

    device_id: 253da192a574953187a6ffa226818201

    entity_id: binary_sensor.bedroom_2_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 0

      seconds: 0

  - type: is_not_open

    condition: device

    device_id: b1c35c134c59dd8979a12b3c488e301e

    entity_id: binary_sensor.bedroom_door_contact_sensor

    domain: binary_sensor

    for:

      hours: 0

      minutes: 0

      seconds: 0

  - condition: time

    after: '21:45:00'

    before: 04:00:00

  action:

  - service: script.air_filters_five

  - service: light.turn_off
- id: '1641139168960'
  alias: House Awake - True
  description: ''
  trigger:
  - type: opened
    platform: device
    device_id: 253da192a574953187a6ffa226818201
    entity_id: binary_sensor.bedroom_2_door_contact_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 2
      seconds: 0
  - type: opened
    platform: device
    device_id: b1c35c134c59dd8979a12b3c488e301e
    entity_id: binary_sensor.bedroom_door_contact_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 2
      seconds: 0
  condition:
  - type: is_open
    condition: device
    device_id: b1c35c134c59dd8979a12b3c488e301e
    entity_id: binary_sensor.bedroom_door_contact_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 1
      seconds: 0
  - type: is_open
    condition: device
    device_id: 253da192a574953187a6ffa226818201
    entity_id: binary_sensor.bedroom_2_door_contact_sensor
    domain: binary_sensor
    for:
      hours: 0
      minutes: 1
      seconds: 0
  - condition: time
    after: 06:00:00
    before: '12:00:00'
  action:
  - type: turn_off
    device_id: e96371bd1b708dc58fea65766f48450f
    entity_id: switch.salt_lamp
    domain: switch```