Unifi Devices Tracker - Missing on Restart

Hi all,

I have been reading up on the Unifi changes and issues with presence detection and device trackers but I think this issue is not reported and hoping this isn’t the new intention. I have friends and family setup with Unifi device trackers to detect home or away. I have noticed that if I restart HA without the devices present any longer on the network, they just vanish from the entity DB / HA instead of staying and being marked away on restart. I can reproduce the result now.

Test

  • Added my IPAD as a device_tracker to my Lovelace card.
  • Entity shows as Home
  • Powered off my iPad to simulate leaving the house
  • Waited for Unifi clients to show it missing and HA shows it as AWAY. I did notice though under Integrations that the tile was now missing but the entity still showed up in STATES.
  • Restarted HA
  • HA now has unknown for the iPad device tracker and its not an entity in the system anymore.

I would expect it to stay forever somewhere in the system so I can use it for tracking state much like I did before with known_hosts.

Confirmed the same behavior on 0.97.1 as it just launched.

I see a PR that seems to be the problem I am having so its possible this is coming in a future patch.

Hi! That PR is part of 0.97 and you’re saying it doesn’t work?

Well can you describe what it should be doing? I can’t tell if the PR is to only load things back that were online within 30 minutes or if the new mode is to not load them at all. If a device is away for longer then 30 minutes and I perform a restart will it show up with state Away or Unavailable.

Either way it’s intended, it does not seem to be consistently working with my devices.

I continue to have this issue with devices that are away for a day going into unknown state and missing once I restart while they are away.

Anyone else seeing this too?

I am also quite frustated over this Unifi change. I see the same error with the device missing if you restart HA. But my general problem is that my devices never appear as home now.

It seems like the integration is not working correct, so I tried to remove it and create it manually again, with no success. HA seems to have connection to my Unifi controller, but the state shown is wrong. I notice there can be an issue with time syncronisation and I may have to check that - have to find out how… But why is this suddenly an issue - device tracking worked absolutely fine until I upgraded to 0.97 from 0.95.

Peka, Have you checked that the device-tracker-entity name is still the same? (Under configuration/integrations/unify) ?

Since the migration to the new version, some of my device-trackers seem to have gotten new names. (added _2 after original name for most I think)

So new devices show up for me, but they immediedtly come over as MacAddress named since I have not had time to rename them. In my old flow, I would name them in Unifi, and add to track changes - true. Now I just go into HA and rename the entity or delete it and have it refind it once renamed.

For my existing tracked devices though I continue to have devices go missing on every restart if they are not at home. Its broken every presence automation because of it, so I’m looking at moving the kids to IOS (not ideal because they power off their devices for school and zone pushes only occur if powered on) or take the old version and put it back as a custom component. I’m not familiar enough with the code to understand why it is not working or if it IS working as designed. Its just not consistent for me, so I think there must be a condition occurring that is not accounted for.

The time was not syncronised on my Unifi Controller. After updating my Unifi Controller and ensuring the time was the same as Hassio i am now able to see devices with status home. However some devices now have new names ie. device_tracker.alex_iphone is now device_tracker.alex_iphone_2. So now my pictures is no longer connected to my devices. I have tried to make changes in known devices so it fits the new device tracker names, but still it does not match and pictures and friendly names are gone. Any ideas?

known devices isn’t used by unifi integration anymore

I have the same issue. Devices disconnected from the network longer than an hour are reported as

"entity not available: device_tracker.########" 

after home assistant restarts (0.98.2)

Definitely still and issue. I also started a thread about it: Unifi Devices Tracker - Missing on Restart

I am just now having this issue in 0.106.5 where away devices on restart show as unavailable and never update. Any known fixes?

I’m working on improving situations but I need debug logs

I there any update on Unavailable devices? I too have the problem that if HA restarts while I’m not at home (means: disconnected from the unifi AP), then the device will be in “Unavailable” instead of “Away” like before. I thinkg the addon should assume the last known state for a device in this case.

There is an issue on github about it but I haven’t
Investigated more than looking at some logs so far

Just for reference, this is the issue: https://github.com/home-assistant/core/issues/34140

Hope you can look into it in time.