Reliable presence detection but not bluetooth

I use the router and Google maps for presence detections but I’m not 100% happy with it and looking into Bluetooth also.

The router takes to long to detect that I’m home and way to long to detect that I’m no longer home. I’m assume it holds on to my phone details for a while just incase for quicker reconnections.

Google maps is good but still takes about a minute to change my details to home. Looking for something more instant or 10 seconds in time to detect.

I’ve found that using the previously mentioned monitor (on two Pi Zeros) along with WiFi (in my case nmap), sensors on the exterior doors, and some automations are rock solid. I do use GPS, but not for home/away.

The current logic is:

  1. Mark somebody as home if either monitor instance or WiFi shows them home
  2. When the front door is opened, scan to see if somebody has arrived (BT arrival scans also happen automatically)
  3. When the front door is closed, wait for the arrival scan to stop, wait 30 seconds more, then scan to see if somebody has left
  4. Only mark somebody as having left if all their trackers show them as away and the front door was closed in the last 10 minutes

I’m probably going to change this up slightly, so that the last step requires only two of the three trackers to show them as away, and a five minute window for the front door.

The result is that detecting us as arriving home is pretty quick. Worst case we’re usually detected home before we finish closing the front door, sometimes we’re detected as we approach the front door.

3 Likes

Some really useful comments here. Many thanks for contributing.
I have tried Google maps also and found it took to long to update. Router I have not tried as mine not supported but I would guess the same lag in updates.

I am looking into Monitor as this seems to be the most reliable and I have had good experiences using the standard BT in the past.
It’s another box but I guess for reliability it makes sense.

I would be interested how the new Android app that is being developed implements presence detection but I can’t wait that long as currently I have to manually set the alarm which normally sets automatically with presence detection.

I might look at GPS later for general location tracking but not for presence detection.

Thanks for all the suggestions. I will update the thread when I have tried out Monitor.

I just dropped my router setting and added ping and find it now only takes 10seconds to detect me home and away.

I still use Google maps for gps tracking plus it also allows fall back if I disconnect wifi while at home. Still keeps me at home instead of marking me away.

Give ping a try as I was impressed by it. Just have to reserve an IP to the devices you want to track, which your router/modem should allow.

If you don’t want to allocated fixed IPs, then the nmap tracker is an alternative.

I tried a few of the others and I currently use Life360 and ping and use a basin sensor. It seems to be the most reliable for me. I couldn’t rely on Bluetooth because I don’t always have it turned on. I haven’t notice any false triggers.

Basin sensor?

I’m pretty sure they meant Bayesian

Of course.

Yes, I meant Bayesian. Thanks! Darn auto-correct
.

I might try Life360 and Google Maps a go and combine with either Ping or nmap to see how I get on.
I have been looking into and trying to configure Monitor but it is not that easy to work out and has been driving me mad trying to get it to work.

I will report back with finding.

Thanks for all the advise.

@pnbruckner has a composite device tracker that integrates several device trackers.

I use an appdaemon script (since the composite didn’t exist when I needed this) to do something similar; it:

  1. Only uses Ping to change state to “home” (so if my phone disconnects, it won’t show me as “away”)
  2. Uses both google maps and life360 (though any one of them seems sufficient)
  3. Can integrate any other sensor you’d like.

I modified this from a script by arsaboo.

I haven’t tried the composite, but the script works great for me (android). I’ve had a few false “away” reports from my girlfriend (iOS). The only thing different in out setup is that she also uses the iOS component. But for pure android life360/google maps/ping, I’ve never had a false report.

Have you tried a bluetooth dongle on USB and pass it through Proxmox to your home assistant config? This will probably work (haven’t tried it myself though). The internal bluetooth adapter of the NUC is for as I know not usable.

Glad it’s not just me that can’t get their head around getting Monitor set up.
Shame there isn’t a youtube video showing the process of getting it up and running (I understand flags etc have changed over time, but from what I can gather the general process itself remains much the same?) and then a link to the latest flags and their uses.

If it helps, here are the steps I followed to get Monitor running: Bluetooth LE Tracker issues

1 Like

Thanks for the details on Monitor. I will give it another try. Would be good the get a detail YouTube on the setup of this as many are finding it difficult.

I set up Ping just to get things working without the Bluetooth and also added Life360 which I promptly uninstall as it killed my phone battery.
I don’t need to track our phones outside of home so until some sort of battery friendly solution is available I’m happy not to have this functionality.

If I still have problems with Monitor then I might try a USB dongle in the NUC and see if I can pass that through with Proxmox and then use that and Ping. The problem with a USB dongle is that there are not many with good compatible with Linux.

I’ll update on progress as I go and thanks for all the suggestions

I use the ASUS BT400 as a Bluetooth stick on my server and Linux itself doesn’t seem to have a problem with it, for presence detection it seemed more a case of HA’s BT trackers not working correctly on anything other than the Pi’s BT.

I am currently using it to connect to a Mi Flora sensor and it seems generally OK, though might be tempted to set up Plant Gateway, as it would appear to be more reliable.

Hi,
I am still having issues with setting up Monitor. I looked at the link to your post but I am getting an error on behavior_preferences file. I could not find this file so I created it in the monitor directory. Is this correct or does it exist and I just cannot find it? I’m getting the error.
behavior_preferences: line 1: “PREF_DEVICE_TRACKER_REPORT=true”: command not found
Any ideas?

Start it once with sudo bash monitor.sh, I guess I didn’t realize I had started it previously, the first start should create it.

I have sorted this out. Systems asked me to create default file after failure which it did and I can now see the correct behavior_preferences file