Using Binary Sensors for room occupancy

A quick an easy way of using multiple sensors for room occupancy in Home Assistant is to use Template Binary Sensors. Using these you can add further sensors down the line with only a single line of YAML code.

Here’s an example from my shower. The light stays on if motion is detected or the humidity is above 60%, indicating that someone is taking a shower:

platform: template
    friendly_name: "Shower occupancy"
    device_class: occupancy
      minutes: 3
    entity_id: binary_sensor.shower_motion
    value_template: >-
      {{ is_state('binary_sensor.shower_motion', 'on') 
          or ( states('sensor.shower_humidity') | float > 60 ) }}

Other examples include: Using a television to detect if the living room is occupied and using Tasker in combination with NFC tags.

Photo by Tim Mossholder on Unsplash

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.