
Perfecting room occupancy detection can be quite a daunting task. Traditional solutions, such as using motion sensors scattered across various locations, may not always hit the mark. Imagine being deeply engrossed in an adrenaline-pumping novel or caught up in the latest gripping TV drama, only for you to be abruptly enveloped in darkness because you've been still for a while. The annoyance of having to execute a panicky hand dance in front of a sensor to resurrect the light is all too familiar.
Contents
How template binary sensor can help perfect occupancy detection
Welcome to the world of template binary sensors, a dynamic solution that empowers you to utilize a diverse range of sensors for superior room occupancy detection. You're no longer shackled to just motion sensors; you can now tap into the state of a television (on means occupied) or even a humidity sensor (high humidity indicates the presence of a person savouring a steamy shower).
Incorporating additional occupancy sensors
One of the prime advantages of template binary sensors is their flexibility in integrating additional sensors down the line. Bid farewell to the laborious task of reprogramming multiple automations, as you can easily incorporate new sensors. Should you invest in another motion sensor, it can be seamlessly integrated into your existing room occupancy binary sensor, smoothly becoming part of your pre-existing scripts and automations.
A tangible demonstration of template binary sensors in action
To give you a sneak peek into the realm of template binary sensors, let's take a detour into my Home Assistant setup. In the bathroom, I've devised a binary sensor that considers the room “occupied” if humidity exceeds 60% (a tell-tale sign of a shower in action) or if the motion sensor picks up movement. This ingenious blend automatically lights up the bathroom when it's in use. The icing on the cake? I can incorporate an infinite array of sensors into this binary sensor for even greater accuracy and automation.
platform: template
sensors:
shower_occupancy:
friendly_name: "Shower occupancy"
device_class: occupancy
delay_off:
minutes: 3
entity_id: binary_sensor.shower_motion
value_template: >-
{{ is_state('binary_sensor.shower_motion', 'on')
or ( states('sensor.shower_humidity') | float > 60 ) }}