Using Binary Sensors for room occupancy

Disclosure: This post contains affiliate links. If you click through and make a purchase, I will earn a commission, at no additional cost to you. Read my full disclosure here.

Reliable room occupancy detection can be a challenging task, as traditional methods such as using motion sensors in multiple locations may not always be accurate. Picture yourself engrossed in a thrilling novel or captivated by the latest TV drama, only to be plunged into darkness because you haven't stirred for a while. The inconvenience of having to perform a frantic hand dance in front of a sensor to bring light back is palpable.

Enter the realm of template binary sensors, a versatile solution that allows you to employ a variety of sensors for enhanced room occupancy detection. No longer are you confined to motion sensors alone; you can harness the power of a television's state (on equals occupied) or even a humidity sensor (high humidity suggests someone is enjoying a steamy shower).

Adding more sensors

One of the key benefits of template binary sensors is their adaptability in accommodating additional sensors down the line. Say goodbye to the tedious process of rewriting multiple automations, as you can simply integrate new sensors with ease. If you invest in another motion sensor, it can be effortlessly added to your existing room occupancy binary sensor, seamlessly becoming part of your established scripts and automations.

A practical illustration of template binary sensors in action

To offer a glimpse into the world of template binary sensors, let's venture into my Home Assistant setup. In the bathroom, I've configured a binary sensor that deems the room “occupied” if humidity surpasses 60% (indicative of a shower in progress) or if the motion sensor detects movement. This clever combination automatically illuminates the bathroom when it's in use. The cherry on top? I can incorporate an unlimited array of sensors into this binary sensor for even greater precision and automation.

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 ) }}

About Liam Alexander Colman

is an experienced Home Assistant user who has been utilizing the platform for a variety of projects over an extended period. His journey began with a Raspberry Pi, which quickly grew to three Raspberry Pis and eventually a full-fledged server. Liam's current operating system of choice is Unraid, with Home Assistant comfortably running in a Docker container.
With a deep understanding of the intricacies of Home Assistant, Liam has an impressive setup, consisting of various Zigbee devices, and seamless integrations with existing products such as his Android TV box. For those interested in learning more about Liam's experience with Home Assistant, he shares his insights on how he first started using the platform and his subsequent journey.

Leave a comment

Share to...