Every 6 months I try to incorporate device tracking in my HA system, I try for a month, get fed up and stop again for another six months.
I am attempting to use the Unifi integration again. It thinks my phone (and my wife’s phone) are constantly getting on+off the netwrok. My iPhone has been sitting on my desk all day and when I look at the history its on/off/on/off for the past few hours.
I do have my “time in seconds to be considered away” set to 30 seconds… which i realise is lower than the default of 300, but the few youtube videos I watched had theirs set to 30 or 10.
But in theory, it shouldn’t even be reaching 1 second as it’s not falling off the network.
Any ideas on how to make this usable? (I don’t really want to keep upping the seconds-aways value, as that defeats the purpose of telling me when the user has left the zone), and 5 mins after the fact isn’t helpful.
The phones are NOT set to randomize their mac address on the network.
And checking the uptime for my phone inside my Unifi console and its: 15h 12m 51s
With the companion app, won’t I need to use the paid Nabu Casa service? or at least have a VPN to my home network running on my phone?
Otherwise it wouldn’t be able to inform HA that I am now no longer on the network? or ?
You phone might be just idling on the desk, but the power saver settings can and often are set to deactivate WiFi, and idling means you are not using it, so no priority is needed.
I have an iPhone and 2 Android in the family, and using nmap integration for device tracker, and I know nmap is tracking via arp. What I learned from this setup is that, for Android, things are fairly consistent, but for iPhones, night and day. iOS has some anti-tracking and power conservation mechanism built-in you cannot get around, it seems.
So, if the device tracker feature under unifi integration uses arp also, you probably could see the same thing on your iPhone.
One way to test the theory is to setup the nmap integration and configure it to track the IP of an iPhone… see if the plots would more of less line up with plots from unifi integration on the same device.
The device tracker feature for Unifi actually gets the data directly from the controller of what devices are actually connected to the access points at that moment in time. If the iPhones aren’t connected at that moment then they will be reported as away, once the last connected timestamp is at least the configured threshold (30 seconds for OP) ago. There is a good chance that the iPhone only checks in once a minute. As long as the device is still regularly checking in - Unifi won’t record it as offline. I don’t know what the time period is that Unifi waits before declaring a device is offline though. I also don’t know if the iPhone uses any of the battery saving extensions to WiFi that allows the radio to go to sleep. At a guess though - I’d assume that the iPhone is probably using the battery saving feature - so the radio can go to sleep and wake up periodically to check if there are any messages for it, as long as the radio continues to connect during the scheduled window - then Unifi will consider the device to be online, even though for a period of time it’s not really.
EDIT:
The UniFi Network Application has a 60-second disconnection threshold, meaning that it will wait one minute for a response from the device before declaring it disconnected.
Ok, this is good to know! I am going to set mine my ‘considered-away’ threshold to 120 seconds and see how much of an improvement that makes for the next few days.
You need to look at the phone settings.
The UniFi device just report the phone behaviour and the HA just report the UniFi device behaviour.
If you can not change the phone settings, then you need to increase the time to fit the phone settings.
The settings in the UniFi device is of minor importance.