I’ve been fighting with reliable presence detection since long before my Home Assistant days. This is a problem that a lot of Smart Home type platforms deal with, especially when trying to use various mobile apps to detect a phone within a geofence. Reaction speed can be sluggish, or sometimes downright not work at all, and it seems that even setting the tracking app to be exempt from battery optimizing measures can still cause the app to get killed off in the background and not work again until you notice and restart it.
After I moved away from SmartThings, which had downright horrible presence detection with their mobile app, things did get much better with Home Assistant and Owntracks (Android version). I would say that our presence detection was up to about 90-95% accuracy. Since I rely on presence detection to shut off security cameras, when it didn’t work it would always be a nuisance of constant notifications to my phone as someone came home and walked throughout the house – setting off every camera as they moved around.
I was really frustrated with presence detection lately. I needed it to use the phone and not anything else, but I needed to know if the person was home or not and that person may not always take the same car (which ruled out BTLE beacons in each car), and they may not always have any sort of bag or purse on them, which would rule out BTLE beacons in any of our laptop/work bags and purses around the house.
The solution was right in front of my eyes the whole time.
I switched to a Ubiquiti UniFi UAP-AC-PRO earlier this year for WiFi. If you don’t have good WiFi at home, this AP is the solution to all your problems and more. Ubiquiti also hired one of the main brains behind Home Assistant last year to help grow the project with their backing – so the integration should be pretty darn good between the two systems!
Well, as it turns out, my UniFi controller can be used as a presence detection device! All devices on the wireless network are fed to Home Assistant as presence detection devices, and based on them being connected or not, they’ll indicate as Home or Away in Home Assistant.
I gave this a test and it worked flawlessly. You can control the timeout for when a device is flipped to away, which I left at the default five minutes. This allows me time that if I need to briefly disconnect from WiFi while at home to test or troubleshoot something, it won’t immediately flip me as being away. Upon reconnection, within under ten seconds, it seemed, I was always reliably flipped back to Home. Since my AP can be picked up a bit outside our property bounds, this means that by the time I pull in the driveway, park the car, and make it to the front door, I’m generally always flipped back to Home. Even if I do make it in the door before it flips back, I won’t hit my first security camera for another few steps, so the time spent taking off my shoes and hanging up my jacket is more than enough for any straggling connection delays to flip me to Home. It just works, finally.
Going a step further
Now that you track all WiFi devices for presence and don’t need an app, let’s think of the possibilities in addition to just saving battery and having one less app on your phone.
You could now add friends and family into presence tracking too. For instance, my parents sometimes watch the house when we travel and now I could setup an entity for their phones and also have those phones disarm the security system too. Previously, whenever they came over to check the place we’d just get hammered with motion alerts and camera snapshots – whatever, we dealt with it, but now we could just disarm the system entirely and save the annoyance.
You could factor friends and family into all sorts of automation! Maybe you have the house automatically cool down or heat up at a certain time of the night before bed, but want to delay the action if you have guests over because it means you’ll be up late – well, if any of your friends or family phones are present, you could have the system not do that action.
What about sending an alert if a device that should have a persistent WiFi connection suddenly goes “away” – like alerting if a smart home device has potentially developed an issue and disconnected from WiFi? This would be particularly great for the WiFi outlet controllers I use to control our indoor security cameras (off when home, on when away). The sky becomes the limit.
My point is
It didn’t seem well published that Ubiquiti devices had such awesome presence detection in Home Assistant. They were just another tile on the large page of “things” that support presence detection. Their presence detection works better (so far at least, I’ll update if that changes!) than any methods I’ve previously tried and requires little more than a device connected to WiFi. Their WiFi APs themselves are also awesome, and that’s totally aside from Home Assistant. For as little as $100 you can have totally app-free presence detection for your family, friends, and other random devices too.