Device trackers using Unifi integration?

I know there have been discussions on this topic over the last weeks culminating in a quasi-“fix” in the latest release but I’ve still got questions…

I just got all of my new unifi network equipment running and set up the Unifi integration in HA. And it (sadly & expectedly) added every single device on my network to my entity registry. That’s OK, since we now supposedly have a way to deal with all of those we really don’t want to track.

I dutifully went thru the entity registry and selected all of the ones I don’t want to be tracked and turned off the “enable entity” switch. The good news is that they aren’t showing up as entities in the states page. But the bad news is that they all show as “unavailable” in the entity registry…all 50 or 60 of them…:roll_eyes:. So now I have a very long list of device trackers to scroll thru every time I need to go do any work in the entity registry.

OK again, since we also have the ability to “delete” the entity from the entity registry as well so I’ll just do that. Then when I click on the “delete” button I’m greeted with this pop up:

ex

What the heck does that even mean?

Why would deleting an entity not remove that entity from HA? Where will it still be? in some sort of “.storage” file limbo? I thought we weren’t supposed to be required to edit those files manually.

And as a follow on, let’s say that I decide I don’t want to track an entity so I click the “delete” button so my entity registry isn’t cluttered up with those 60 entries that I don’t even care about. Then let’s say that later I decide that I want to actually track the entity again (one of my kids decides to move back in for a while, or whatever). How do I get that entity back into the system again if there is no longer any manual device tracker configuration for individual entities?

Before this new system was implemented the entity was still listed in the known_devices.yaml file and I could just turn the entity tracking (and, hence, it’s existence in the system) on & off at will in there.

I think I may be missing something critical in how the new device tracker paradigm is suppose to work and be “better”.

I’d like to say I agree with you because I think I do.

The point of that being that the whole thing is not at all well described. I find the whole Integration / entity / .storage thing very unintuitive and as far as I can tell not well documented (at a user level) anywhere.

I am currently just going along with it all in the hope that it will one day be made clear what exactly everything means and what is actually going on. That is in part because I don’t want to incur the wrath of all the “what do you expect for free” brigade :wink:
(And that it is of course quite possible that I have missed some documentation somewhere…)

1 Like

Ok so this morning I started to figure out the new way the Unifi configuration works, specifically what changed. The best I can tell is that the Integration adds the controller and does a discovery including switches for the POE ports and device trackers for all the clients and attached devices Unifi sees.

What I first noticed was how many foreign device_trackers I now had to manage!! then I realized that every client wired or wifi unifi sees got imported as a device tracker including switch ports, APs and Cameras. I reread the newest documentation and heres what i came up with.

To filter this mass amount of device_trackers down to a more meaningful device set, you have a couple options that can be facilitated entries in the yaml config under the device_trackers: where you can filter out Unifi devices (APs, Switches, Cameras) and devices connected to network Switch ports leaving all the wifi devices to be imported as device trackers with just two lines of code.

device_tracker:
  - platform: unifi
    host: !secret unifi_host_ip
    dont_track_wired_clients: true
    dont_track_devices: true

in my system the dont_track_devices element is is throwing an error and not working …

Finally there is a way to block additional devices by MAC addresse using the block_client list value. I have not started this process but my lifx bulbs, wyze cameras, nest devices and august doorbells and locks will be getting filtered from the device_trackers being monitored!

once these items are configured in yaml I had to remove the integration, reboot HA and re-add the integration and i found a more acceptable list of devices. I hope this provides a starting point…

I am excited for the direction this has taken and this is a pretty big uplift from the way it worked before.

First, let me start out saying thanks for replying. I’m sure it will help others just starting out with the Unfify integration. Unfortunately, I mostly already figured all of that out. And unfortunately, most of that doesn’t really solve any of the issues I have with the new integration.

For example, yes, you can only track wireless clients but for some reason my Unifi controller is seeing my wifi connected cell phone as a “wired” client connected to my Unifi Switch. So if I blocked wired clients then it would not track my phone. I’m not really sure why the controller is behaving that way. I’ve got 48 clients showing as connected but only three are shown as wireless. That’s not even close to being correct. If anything i’d say that the majority of my clients (~30 or so…) are wireless. Bottom line is tracking only wireless clients won’t work.

The “don’t track devices” could help a bit but if I enabled that it would only remove three device trackers so it’s not much help really.

As far as not tracking new devices there are times when I actually do want to track new devices that connect to my network. Before with my Asus tracker it would discover new devices and in the known_devices.yaml I could just add “track: true” or “track: false” to either create (or not) a device_tracker for that device.

As of now we only have the option to turn off “enable entity” for the new devices. But that leads to the problem of having an entity registry list a mile long filled with devices you don’t want to see or use. And per my question above if I try to delete those entities it says they will still be included in HA but just not visible. Why and where are they still stored? I assume it will be in the .storage files somewhere? And if I later want to start tracking them again then how do I get them back to being visible? How do I “un-delete” them? Do I have to manually try to edit the .storage files…that we aren’t supposed to ever touch? And since we have no known way of manually adding devices I’m not sure how to retrieve my clients from “entity registry purgatory”. :man_shrugging:

And lastly (I think) is that I’m not sure the “block_client” option works the way you think it does. From my reading of the docs I think that it doesn’t just block the device from being tracked in HA but instead it will tell the controller to add that client to the list of devices that it prevents from connecting to the network itself. Just like if you go to the controller and select “block” for the device in the “clients” list.

Maybe it is better than it was before and I just don’t know how bad it was since I never used it before now. But from my experience using the Asus device tracker platform previously this is a huge step in the wrong direction. I have way less control over my devices in HA now than I did before.

I’m going to cross post my original post in the main V98.0 release thread. Maybe it will get answers there.

1 Like

so I added a few of my Lifx bulbs to the block_client list and it did NOT drop my lights from Unifi. Sadly the integrations still discovered my bulbs. I need to come up with a way to filter individual devices from being discovered as device trackers by unifi…

Put them as disabled. If you change the system options for UniFi to disable by default you can opt-in those devices you’re interested in

I know I can disable them, but then I have to disable about 100 devices. I have a large Unifi network and a ton of WiFi bulbs, cameras and Sonos. Its a pain in the rear to have to disable things especially when there is a setting that should block them from discovery.

# Unifi
  - platform: unifi
    host: !secret unifi_host
    dont_track_wired_clients: true
    dont_track_devices: true
    detection_time: 60
    block_client:
      # backlight
      - 'aa:aa:aa:aa:aa:aa'
      # Bath_1
      - 'aa:aa:aa:aa:aa:bb'
      # Bath_2
      - 'aa:aa:aa:aa:aa:cc'
      # Bath_3
      - 'aa:aa:aa:aa:aa:dd'
    ssid_filter:
      - 'wifi_network'

if I can get the block list working I can save a ton of work filtering out wireless devices I cant use as trackers (speakers, thermostat, smoke detectors, cameras, light bulbs, vacuum, etc ).

Block list is about controlling network access for specific devices

Well its not doing that either. :sunglasses: please keep in mind this is from my device_tracker.yaml not from an integration configuation…

If we are going to poll Unifi in this way we need better filtering for device trackers.

And to be clear… this newer version of the integration is so much better than before I don’t want to be confused as complaining, just sharing my opinion.