Areas as trigger?

Hi everybody,

I have two motion detection sensors for the downstairs hallway as well as two lights in that very hallway.

Below are my automations to turn these lights on and off. Is it possible to use area for the trigger as well as for the service lights.turn_x as well?

So to replace entity_id: binary_sensor.flur_motion_occupancy, binary_sensor.treppe_motion_occupancy with the area_id these sensors are connected to…

automation:
  - alias: "[Motion] Flur Licht An"
    description: ""
    trigger:
      - platform: state
        entity_id: binary_sensor.flur_motion_occupancy, binary_sensor.treppe_motion_occupancy
        to: "on"
    action:
      - service: light.turn_on
        target:
          area_id: e54713ba30f851750ebe5d731a417877
    mode: single
  - alias: "[Motion] Flur Licht Aus"
    description: ""
    trigger:
      - platform: state
        entity_id: binary_sensor.flur_motion_occupancy, binary_sensor.treppe_motion_occupancy
        to: "off"
        for:
          seconds: 45
    action:
      - service: light.turn_off
        target:
          area_id: e54713ba30f851750ebe5d731a417877
    mode: single

There are two things I don’t like about my current solution:

  1. let’s say there is still motion detected by binary_sensor.flur_motion_occupancy, but the entity binary_sensor.treppe_motion_occupancy has been off for 45 seconds. In this case, the lights will turn off, even though I’d like them to stay on

  2. I have even more sensors in the yard (though different use cases) and it’d be nice to just have Home Assistant watch any sensor that is assigned to the area backyard instead of having to manually add them to the .yaml file whenever there is a new sensor.

Is this possible? A different approach would to put these motion sensors into a group, but again, this requires to manually modify the file defining that group (rather than just assigning an area to any new sensor).

Thank you in advance for your ideas :slight_smile:

Hi @prankousky,

This post is from a while ago did you ever find the solution? would really like this too.

Thanks!

Unfortunately, no. I went with the groups solution. Just create a helper entity containing all the motion sensors you need, then use that as trigger.

While I’d still prefer the area trigger, this works fine.