Need help to add a condition to an automation

I have a presence sensor in my garage to keep the light on while someone is inside, and to turn it off a few minutes after no one is detected. This part works fine:

alias: Screek 4B10FE presence became NOT OCCUPIED
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.screek_humen_sensor_1u_4b10fe_presence
    for:
      hours: 0
      minutes: 10
      seconds: 0
    to: "off"
condition: []
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.vulcan_relay
mode: single

But, there is a dead zone on the other side of the garage, so I added another sensor there. By itself it works fine using the same automation just changing the entity ID.

Here’s the problem. If I stay too long under sensor1, sensor2 will timeout and turn the light off. Not fun if working with power tools at night. So, I added a condition that the other sensor has to be off as well:

alias: Screek 4B10FE presence became NOT OCCUPIED
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.screek_humen_sensor_1u_4b10fe_presence
    for:
      hours: 0
      minutes: 10
      seconds: 0
    to: "off"
condition:
  - condition: state
    entity_id: binary_sensor.screek_human_presence_sensor_1u_4b683c_presence
    state: "off"
    for:
      hours: 0
      minutes: 10
      seconds: 0
action:
  - service: switch.turn_off
    data: {}
    target:
      entity_id:
        - switch.vulcan_relay
mode: single

This sort of works, but the light won’t turn on unless both sensors have been off for the timeout.
Is there an easy way out of this problem?

(I know, the people at Screek can’t spell).

Make a group with the two sensors and add the resulting sensor (you can customize it to also liik like a motion sensor) to your automation instead of the actual device entities

1 Like

Thanks. I hadn’t thought of a group.