Hi i’m struggling to find out if i can have multiple entities on one automation.
I have two motion sensors in my lounge and if either change state to “on” then i want my light to turn on.
I have one in there at the moment which works well just wondering how I add second one or do i have to create whole new automation for the second sensor?
awesome do you know how i’d code it.
I have this at the minute
- alias: Turn lamp on when motion in lounge
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0003202853
to: 'on'
condition:
condition: state # from sunset until sunrise
entity_id: sun.sun
state: 'below_horizon'
action:
- service: homeassistant.turn_on
entity_id: switch.lounge
- alias: Turn lamp on when motion in lounge
trigger:
platform: state
entity_id:
- binary_sensor.motion_sensor_158d0003202853
- binary_sensor.motion_sensor_the_other_one
to: 'on'
condition:
condition: state # from sunset until sunrise
entity_id: sun.sun
state: 'below_horizon'
action:
- service: homeassistant.turn_on
entity_id: switch.lounge
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_158d0003202853
to: 'on'
- platform: state
entity_id: binary_sensor.motion_sensor_the_other_one
to: 'on'
- alias: Turn lamp on when motion in lounge
trigger:
platform: state
entity_id: binary_sensor.motion_sensor_158d0003202853, entity_id: binary_sensor.motion_sensor_158d0003466812
to: 'on'
condition:
condition: state # from sunset until sunrise
entity_id: sun.sun
state: 'below_horizon'
action:
- service: homeassistant.turn_on
entity_id: switch.lounge