How do you make presence detection actually reliable?

Presence detection seems like one of those things that’s never 100% reliable on its own. Phone GPS, WiFi, motion sensors — they all have their quirks. What combination actually works well in practice?

What phone do you have?

There’s no one answer and it depends on the space. The best I have found is a combination of PIR and mmWave sensors. This has increased, for me anyway, presence sensing to 95% reliability. My wife, who is more than a foot shorter than me, however, often suffers Spontaneous Massive Existence Failure according to the mmWave sensors.

mmWave sensors do still have quite a few quirks, but they are getting much better with every generation (this is one place where machine learning models are actually improving user experience). The Aqara FP2’s that are my primary mmWave sensors have a lot to reccommend them, their main issue is that if you haven’t calibrated them carefully and set the minimum required sensitivity they will “get stuck” on with false positive detections.

For the spaces where I need the best reliability, I have a series of meta “sensors” that are groups of several different possible presence indicators and this goes beyond even the motion and mmWave. For instance, my master bathroom “sensor” is on if any one of 6 different switch items are active. On the other extreme, my laundry room requires only a motion sensor as one is very rarely just standing still for several minutes in that space.

I’m using a combination of door/window/blind contacts, motion detectors, wifi detection and a door lock state (nuki)

Then I try to combine this into different states like

  • AWAY
  • MAYBE PRESENT
  • PRESENT
  • MAYBE SLEEPING
  • SLEEPING

AWAY is if no wifi client is detected, all doors are closed and main door is locked

MAYBE PRESENT is, if no wifi client is detected, but the door is unlocked and motion detectors are triggered. If the door is locked again, it falls back to AWAY.

PRESENT is, if wifi client is detected

SLEEPING is triggered by a button, if it comes from PRESENT

MAYBE SLEEPING happens if some light is switched on during the SLEEPING state and is falling back after some time into SLEEPING

SLEEPING is changed into PRESENT, if the blinds are open or more then 3 lights are on or the lights are on for more then 30 min.

How fine do you need the detection to be? Room occupancy, home occupancy, or just “near by” is good enough? The answer to that is going to drive the approach. @JustinG’s approach will get you pretty close to the room level.

I go big. If my or my wife’s phone can see my wifi (based on the Android app though you could use Tasker for this) the home is “occupied”. If we are both away the home is not occupied. In those cases where we are both away but we know the home is occupied I have an override switch.

I keep it simple and build my automations assuming a very coarse grained occupancy sensing capability. To be honest, the differences between home and away mode isn’t that big for me either so it’s not really a big deal if the house just always assumes it’s occupied. And the home is almost always occupied anyway. My wife works from home.

I use OwnTracks, which is pretty reliable on my Android; once in a while, however, it is very late in updating my position when leaving home.

On the iPhone (sigh) of my wife, it’s very unreliable. I think it’s got to do with her power saving settings, and that iPhone doesn’t allow overrides to it. The iCloud binding is a bit more reliable, but still… I combine them both for her.

Of course, connected to the WiFi means home, but the iPhone (again!) drops connection regularly. Also, that phone is put in plain mode during the night. And I might disconnect from the WiFi for some reason as well. So no cennection doesn’t mean not home.

All in all, it’s not super reliable, but I use it mainly to turn off all the lights and such. So not a disaster if that’s triggered too late, but quite inconvenient if it’s triggered when it shouldn’t.

If you want a very reliable and fast home/away presence detection for the iPhone you can use Theengs Gateway, picking up the Bluetooth broadcasts which don’t drop out like the WiFi signals.

Depending on the values you set for BLE_TIME_BETWEEN_SCANS, BLE_SCAN_TIME and TIME_UNTIL you control how responsively the home and away triggers behave.

With just me and my wife and an Apple centered household (iPhones, iPads and Apple TV box as homepod) I have a good result with Apple’s home detection.

With the phones having home rules “when leaving” and “when coming home”, the only purpose is to activate or disable away and/or holiday rules/settings for the house, like turning off lights, appliances, etc. and activating front door lights at certain times, so the neighbours have visibility when they come to feed the cats. The Apple home rules toggle an openHab Homekit switch for myself or for my wife.

This works fine most of the time, although the phones sometimes have their quirks where one is not triggering the assigned switch. Have to delve into privacy settings, which rarely solves the problem, only to find the problem gone, spontaneously, some weeks later.

No specific room presence detection, only some minor rules that when certain lights/appliances are on, together with a specific radio station playing, certain rules do not need to trigger as it assumes that the wife is gone (or sleeps) and I am in the mancave gaming or working from home :face_savoring_food:

I should be able to do some presence monitoring based on room CO2 levels, but I see no reason why for my usecase.

I’m using “ESPectre” (GitHub - francescopace/espectre: Wi-Fi CSI motion sensing for ESP32. C++ SDK, ESPHome, Native, and Matter frontends, browser tools, and a CLI for the full device lifecycle. GPLv3 and commercial licensing. · GitHub) — absolutely amazing! You can detect where people are in a room and how many there are, using just an ESP32. No additional hardware needed!

To identify who’s at home, I’ve been using the TR-064 binding in openHAB for the past two years, and it’s been absolutely reliable. Presence detection takes around 10-20 seconds with person identification, and less than a second without it. You can even track a person’s movement through the house in real time!

I use this to automate things like switching on lights as soon as someone enters a room. At night, the floor lights turn on ahead of me as I walk through the house and switch off behind me, so I can find my way to the bathroom without turning on the main lights.

And when I go to bed, my alarm clock is automatically set based on my calendar for the following day. Everything works together seamlessly! :smiling_face_with_sunglasses:

How do you do to avoid false positives with the mmWave sensors? I’ve read that they are nothing more than motion sensors, just extremely sensitive motion sensors. So I wonder how they don’t get triggered when the wind blows through the window, or moves a plant, for example.
Plus, I have an issue with my normal motion sensors. They can’t see through glass, so when someone is in the shower, the lights go off (I have a workaround for that). Don’t the mmWave sensors suffer from that problem?

I installed ESPectre (with ESPHome) on an M5Stack Atom Light ( m5-docs ) and was impressed by how well it worked.

This is actually the main reason that led me to try mmWave sensors in the first place, they can see through glass and can (most of the time) even distinguish between a person in the shower and just the shower running without a person in there. It sometimes gets confused when the shower door swings open and some signal is suddenly reflected in a different direction. This can cause a ghost presence somewhere else in the bathroom for a few seconds. But, since that still counts as a presence in the bathroom, there’s no functional issue with that.

That’s one way of looking at it, sure. But, at this point, the on-board processing of the sensors does an excellent job of categorizing different movement profiles. False positives do still happen, its one of the quirks I mentioned above. The Aqara FP2 which are the ones I use the most, even do a pretty good job of distinguishing between pet movement and person movement. And, although I haven’t tried them yet, supposedly the new FP4’s are a pretty big leap ahead in identifying different movement profiles.

I’m quite intrigued by ESPectre too. I’ve got a couple new boards on the way right now to give it a try.

Except when the door swung open because of an open window when there is actually no one at home :).
But I get your point, and that satisfied my curiosity.
Thanks a lot for the info!