Argos Room Presence
This project builds a room presence solution on top of my other recent project: Argos. I posted about that too in the community just yesterday. Using just a cheap raspberry pi zero w (plus an attached pi camera, or an RTMP enabled camera) in any room, this project provides a reliable, robust and efficient mechanism to detect if people are present in that room or not, allowing you to then use it as an MQTT sensor in HomeAssistant for automating lighting, media players, heating or what have you in that room, as a consequence.
Preface
For a long time, I’ve been trying to figure out a robust room presence solution for my home automation setup within HomeAssistant. I’ve tried everything from integrating simple battery operated wifi-connected PIR motion sensors to bluetooth LE based detection using a cluster of raspberry pi zero’s running room-assistant. It all works half of the time and then crumbles down like a house of cards rest of the time. After a lot of tinkering and tuning, I have now devised a solution, which I can confidently proclaim, is completely devoid of any false positives or false negatives, and works reliably in the real world. And trust me, when it comes to room presence, what matters is false negatives! Folks absolutely hate you when your fancy home automation turned off the TV and all the lights when everyone was tuned into that game/movie!
So, whats the secret sauce?
argos-presence
provides reliable room presence by using computer vision . Forget all the thermal imaging sensors, PIR motion sensors and bluetooth scanning solutions. Raspberry Pi’s can now run sophisticated computer vision algorithms and even machine learning algorithms (thank you tensorflow lite!) thanks to all the performance advancements in both single board computers and advancements in OpenCV and tensorflow.
Here’s how argos-presence
works:
The executive summary is the following:
- We dont simply set the
presenceStatus
based on motion. We havewarmUp
andcoolDown
periods. - When
motion
tries to switchpresenceStatus
from on to off, we have acoolDown
period where the argos object detection service is called to figure out if there’s a person in the scene, and we keep extending the cool down till a person is detected. This is to avoid false negatives - When
motion
tries to switchpresenceStatus
from off to on, we have awarmUp
period where, again we detect if a person is present or not. This is to avoid false positives . For example, if yourpresenceStatus
recently went from on to off, your lights are in the process of turning off, which can be seen asmotion
by the detector. If we did not have awarmUp
period, your room would keep flipping the lights on and off continuously. - The warmup and cooldown periods need to be configured (sensible tried and tested defaults are already set in the example config) to accommodate for your environment.
You can read how to install and use argos-presence as well as integrate it with HA here