Anyone had luck with nmap component and modern phones?

So i’ve been trying for days with various different configs to get this to work, but im consistently shown as offline whilst home, my config:

device_tracker:

  • platform: nmap_tracker
    hosts:
    • host1
    • host2
      home_interval: 10
      consider_home: 300
      track_new_devices: false
      interval_seconds: 3600

From what i understand a lot of modern phones sleep the wifi, i guess this component can’t be used then?

I use nmap to track an iphone and it is pretty poor at doing so. I’ve had to increase the home_interval to 45 minutes and still get intermittent false away statuses. I use Bluetooth on two other phones (1 android and 1 iphone) with the built in Bluetooth of RPi3 and it is flawless. The range is decent and with my house, Bluetooth doesn’t drop unless the device goes outside the home.

About the only thing I can trust nmap for is that when it says someone is home. They are most likely home, or in the yard somewhere. I can’t trust the away messages from it because like you said, my phone goes to sleep and, suddenly I’m not home anymore. I’ll have to try the bluetooth solution that Kbeesnees suggested. I’m just concerned my house might be a little big for it.

I wish I had a zwave tracker tile kind of a thing. I have so many switches and outlets around the house that my zwave is almost better than my wifi coverage.

There must be a better solution. there is the owntracker platform/component but i worry it’ll drain my phones battery reporting all the time, does anyone have feedback on that method?

I can’t speak for iPhone, but on Android there’s no issue with battery drain that I’ve found (on a variety of devices, and Android versions). Then again, I’ve had no issues with nmap on Android.

I have android phones and a windows phone and use nmap.
As @Tinkerer mentioned, there is no issue with android, however, it does not work with the windows phone. Interestingly, it was not a problem with any phones when I was running nmap on Windows-based HASS.
Perhaps, it is due to some limits in nmap privileges on Lynux-based systems.

Same problem here, but with only these settings it gets kinda useable.
consider_home: 600
interval_seconds: 15

I don’t understand why you are using a interval_seconds of 3600 (which is an hour)?? This way the nmap only scans the hosts once every hour, if it misses a device because it was asleep you’ll have to wait another hour :fearful:

Android 6 causes phones wifi to sleep unless you install an app to disable doze. I wish I had never updated out phones from 5 to 6.

The nmap issue is on android, latest version whatever that is on a Nexus 6p, you cant compare with older versions as they didn’t have these battery saving features in the OS

Edit: as MarkR pointed out it’s called “doze”

Nothing to do with “Linux” OS

From what I understand that isn’t what it’s for, I took from docs this was to scan for “new” devices

It’s scanning for new devices that it can see. So if you were at work and came home, your phone attaching to you home network would be a new device.

no that’s not how its working. I just came home 5minutes ago and i’m showed as home.

Anyway this isn’t relevant, the nmap component is seemingly useless for modern phones, so can anyone recommend a better way to track presence? I looked for some zwave fob or something like that but there doesn’t seem to be much out there! I would like to automate a lot of things on arrival and leaving the property so really do need it!

The thing with nmap is that because the apple and apparently now some android phones go to sleep to conserve battery, nmap can’t see them when they are asleep. The phones need some kind of wake on lan feature.
As far as other methods, all the others I have seen require some app on your phone to track your location. If you don’t have the app running, your phone isn’t telling the system where it is. There is some interesting work going on with BLE trackers, like trackr, but in my opinion, it isn’t there yet. A company called happy bubbles is doing some interesting work, so is trackr. But i’m not happy with the solutions yet.

I’ve tried OwnTracks, nmap, and ping for a Nexus 6P and 5X. Both nmap and ping would have false aways all the time. I originally had issues with OwnTracks as well, but after adding waypoints in the app to use geofences, it’s worked nearly flawlessly with no noticeable impact on battery. The other advantage of it is that it can track other zones as well, e.g. work.

I also have tried using nmap for tracking of my android 7 phone. Finetuning of the interval, running mnap as root didn’t help. Still got a lot of false-aways. I gave up using the network als tracking.

I am now using bluetooth LE (running HA on RPI 3) and a cheap (15 euro) bluetooth LE tag (gigaset g-tag). Works like a charm! (batterylife +/- 1 year and user replaceble)

If you’re on raspberry Pi 3; just buy a bluetooth low energie device like a sporttracker or a simple tag. Attach the tag to your keys and you’re good to go! Still using Nmap for wired devices though.

That gigaset g-tag seems pretty large though for a pocket? As i understand it they can’t be much smaller due to battery?

How quick does it connect when you arrive at the property?, I want to turn on lights inside, handle some other tasks, raise outside light dim levels etc upon arriving

Looks like owntracks may be the best option, it has some additional flexibility like being able to turn on heating if i’m inside a certain radius and such, but it’s constantly pinging back to home right, i would think if there isn’t internet connection or the connection is poor in some places that this would add some load to my device and drain battery. I guess i’ll give it a go and see!

I’ve been using Owntracks with a Droid Turbo since starting with HA and it’s taken a little tweaking with setting the radius. What seemed to make a big difference to me in getting accurate state reporting was adding a iBeacon into the mix after reading this blog post:

As far as battery life, I don’t really see an impact, but I am using a custom ROM and the author does a fair bit of tweaking for battery life. That may be why, but honestly I don’t see it using a whole lot battery time when I look in the battery stats.

Thanks everyone, will try owntracks for now with the pointers mentioned!