I’ve got two automations that are controlling a hallway light with two motion sensors. The 1st one turns the light on when either of the motions sensors detects movement. The 2nd one turns the light off after two minutes when both motions sensors are inactive.
Here’s my proposed automation, putting both of them together.
- id: '2222222'
alias: Hallway
trigger:
- entity_id: binary_sensor.hallway_motion
platform: state
to: 'on'
- entity_id: binary_sensor.stairway_motion
platform: state
to: 'on'
- entity_id: binary_sensor.hallway_motion
for:
minutes: 2
platform: state
to: 'off'
- entity_id: binary_sensor.stairway_motion
for:
minutes: 2
platform: state
to: 'off'
action:
- service: homeassistant.turn_on
data:
entity_id: light.hallway
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.hallway_motion
state: on
- condition: state
entity_id: binary_sensor.stairway_motion
state: on
- service: homeassistant.turn_off
data:
entity_id: light.hallway
- condition: and
conditions:
- condition: state
entity_id: binary_sensor.hallway_motion
state: off
- condition: state
entity_id: binary_sensor.stairway_motion
state: off
Will this work at all?
Thanks!