Homey Community Forum

[TUTORIAL] Presence detection using facial recognition (netatmo welcome)

Presence detection is the holy grail of Homey. And there are a lot of tried and tested methods such as detecting if a device is connected to the wifi, bluetooth trackers and whatnot. But these methods are mostly based on you carrying around a device with you at all times. Suppose you base your presense detection on your phone being connected to wifi, but you forgot to charge your phone or left it somewhere out of reach. Or you base your presense detection on bluetooth beacons, but you can’t find the damn thing anymore. Both situations frequently apply to me, and thus both options were unpractical to me.

Introducing Netatmo welcome! a product by netatmo/legrand.
image

Yes, a pricey product, but when you need to convince your wife that you need to place camera’s all around the house or at least in critical places such as the living room or facing the dinner table you bet the sleek rose gold design helps. But I suppose you could also use an ip camera and the face++ app.

Needed apps
Netatmo (or Face++ and IP camera)
Flow event bus (or flow (default))
Logic (default)
Date & time

Variables needed
Presense_person, numeric variable, 60
image

Facial recognition

When the camera detects a known person, emit an event Presence with value <>.
I currently don’t have an IP camera and Face ++ set up yet, once I have them set up I will add the needed flows to this tutorial.

Countdown ticker


Every 1 minute Homey recalculates the value of the presence variable as Presence_person -1 (note: use curly brackets to indicate a calculation) Ive used a value of 60 (minutes) to consider a person as “away” in my flows, this value could be lower depending on how many camera’s you have set up, we currently have two camera’s set up but only one facing the living room. Between the hours of 22:30 and 8:30 I disable the countdown timer, I use another flow to mark us as asleep between those hours if we are detected by the cameras after 21:30.

Don’t forget to invert the logic and card:
image

Resetting the countdown timer


When a presence event is detected, the counter gets reset to 60.
You could also add the mark person as home in this flow. For some reason I like to keep my actions per flow limited, but in this case, I have several cases where I am marked as home outside of the camera.

seperate mark as home flow


If you’re like me…

Marking a person as away

Every time the ticker changes its value, the logic operator checks if the value is 0 and if the person is home. if the flow continues, the person is marked as away.

Hope this helps people struggleing with presence detection. If you do use this method, you may want to consider disableing homeys automatic presence detection by device in settings, I found that it does cause some issues. My wife loves the aesthetic component of the netatmo camera and hasn’t even mentioned the serious hit in personal privacy!