Add boolean entities to Area object to track presence

It would be really great if Areas could have boolean-style entities associated with them that indicates occupancy in that area. Whether that is a motion detector or determining if some device is on (TV indicates someone is watching even if no motion; oven on indicates someone is in kitchen likely).

This is similar to how entities can be assigned to People so that you can track their presence.

This would GREATLY simplify logic like the following which I have for many rooms in my house:

Then you could group all Areas (or a subsection of Areas, such as rooms in Basement) to easily detect presence of someone at the home overall. Or within certain floors if you created a group of certain areas.

Right now I have a fairly complex way of doing that rollup to detect if the house is occupied by looking at Person occupancy sensors, a rollup of all the motion sensors, and checking if key appliances are currently on. This would all be greatly simplified with “presence” entities assigned on an individual Area level.

I use one template binary sensor per room, no automation or anything:

E.g. office:

binary_sensor:
  - platform: template
    sensors:
      # Room Occupancy
      occupancy_office:
        friendly_name: Büro besetzt
        device_class: occupancy
        value_template: >-
          {% set motion = is_state('binary_sensor.motion_office', 'on') %}
          {% set deskhim = is_state('device_tracker.desktop_dimitri', 'home') %}
          {% set deskher = is_state('device_tracker.desktop_sabrina', 'home') %}
          {% set laptopwork = is_state('device_tracker.laptop_work', 'home') %}
          {{ motion or deskhim or deskher or laptopwork }}
        delay_off:
          minutes: 15

So if motion is detected, or any of the desktops is currently running, the room is occupied, if none of these is true for 15 minutes the room is not occupied.

House occupancy is pretty simple, no person entity is in state home -> house not occupied, otherwise house occupied.

1 Like