Skip to content

Presence Sensing

Jan Seidl edited this page May 29, 2024 · 4 revisions

Magic Areas works by triggering Events whenever it senses a change in the presence withing a given area. Different platforms are used to sense presence (see below) in different ways but all boils down to the states given out by those platforms.

Supported presence sources

Currently, Magic Areas supports the following Home Assistant platforms:

  • Media Player
  • Binary Sensor
  • Device Tracker

This might seem like a limited set but this is due Magic Areas relying on those platforms straightforward states and device_class in order to figure out automatically which entities can be used for presence sensing.

For example, it assumes:

  • If a Media Player entity is playing in a given area, that this area must be occupied.
  • If a device tracked by a device_tracker (say, a desktop computer) is home, then that area must be occupied.
  • If some Binary Sensors (see below for the default and supported device classes) are on on state, then ... you catch the drift!

Default presence states

  • on
  • home
  • playing

Default Binary Sensor device classes

  • presence
  • motion
  • occupancy

Those device classes can be configured on the UI to support additional ones to fit your need. For example you might want to have door device class to indicate presence, as I do for my kitchen-to-garage door.

Known limitations

We cannot reliably decide if a switch entity or other sensors can be used for presence sensing but nothing stops you from using Template Binary Sensors or Switch as X.

Here's a few ideas:

  • Using power consumption of a power sensor within a threshold (I use this for TV, workstation monitors, treadmill and others) with a Template Binary Sensor
  • Using the state of a switch
  • Pairing with Room Assistant sensor depending on which room it has on its state