Nmap tracker "home only" behaviour

Hi!

I’ve been using Owntracks wonderfully for a few months, but since sometimes, in particular phones, it stops sending updates for a while, I thought combining it with nmap_tracker would be a good idea. I followed the instructions and everything works fine, but now I find that Owntracks and nmap_tracker are somewhat “fighting” each other.

I mean, whenever I’m home, both Owntracks and nmap detect it and everything works ok. But if I then put my phone in airplane mode, nmap thinks I’m not in the LAN, and generates an “away” event, even if Owntracks still thinks I’m home (it doesn’t send a new event since my location hasn’t changed, though, so HA switches me to away).

What I would like is configuring nmap_tracker so it just sends “Home” events. It should notify HA that I’m home when it detects my phone inside my local LAN, but do nothing when I’m not, thus letting Owntracks decide. Is that possible?

Thanks in advance!

I have tried owntracks and nmap and found them both very unreliable esp nmap on an iPhone. Owntracks would randomly not work and I found it chewed too much battery. The best setup is to use the custom life360 component. It has worked rock solid for me and my wife. I use this one https://github.com/arsaboo/homeassistant-config/blob/master/custom_components/sensor/life360.py

I remember having read something about iPhones turning to network sleep mode or something like that when at home, and thus nmap_tracker switching them to away. There’s a parameter in device_tracker component called “consider_home” which stops sending “away” events for a time since the moment a device is no longer seen on the network.

I think perhaps I have answered my own question :slight_smile: . Perhaps setting consider_home to a huge number will imply only “home” events are triggered. I’ll give it a try.

I have been down this path, I ended up stretching to 15 min and it would still happen. I had been using Life360 for years anyway and it has always been pretty rock solid. Now I can report when at work etc. I also have an automation so when me and my wife both leave home I turn everything off so having a 15min delay or having them randomly happen while we are home is not ideal. Anyway give it a go, if it works for your needs then great :wink:

Create two device tracker entities for each person. One for nmap and the other for OwnTracks. So you’ll have, for example:
device_tracker.jesjimher_nmap
device_tracker.jesjimher_owntracks

Then group those together, giving you:
group.jesjimher

After that, update your automations to use the group rather than individual device trackers.

The group will always show ‘home’ if either of the device trackers in it show home - this will allow you to put your phone in airplane mode, or cater for the phone dropping off the network.

Only once both device trackers change to ‘not_home’ (Owntracks updates because you’ve left, and you’re off the network), your away automations will run.

I tried this a few months ago and failed. It seemed pretty straight forward so I have no idea why it did not work. If you have any luck with this, please let me know!