Unifi device tracker filling up with hundreds of unknown mac-addresses. Dont track new clients?

Ever since the Unifi device tracker was integrated into HA a few versions ago, I’ve got some weird issue with receiving TONS of new unknown device mac addresses in my device-list (.storage/core.entity_registry).

It DOES coincide with me installing a Unifi POE switch as well, and I since I can sometimes see the MAC addresses BRIEFLY in unifi controller. (As screenshot indicates, sending 0 bytes)

macs

So YES, something weird is going on unifi/network-wise, but my HA-related part of the question is that I’m trying to figure out how to configure the unifi-settings so they work like before when stuff was stored in known_devices.yaml.

I’ve got all my devices I want to keep track of known, and I want to use the unifi integration to keep track of them, when they appear and disappear. But since unifi seems to find about a hundred new mac-addresses every week, I DONT want to track NEW clients.

For some reason, the unifi integration has two separate “settings parts”, where I assume I have to configure “Track network” and “track wired network” clients, if I am going to be able to hook up presence detection for the users using these devices.

I thought that disabling the second settings value “Activate recently added entities”, would stop the weird MAC addresses from being added, but it doesnt appear that way, since I changed that I while ago, but have now reached 900+ devices in my device list…

And I can still see:

Registered new device_tracker.unifi entity: device_tracker.unifi_a4_0b_ed_e7_18_e1_default

In the logs.

Sorry if my query is chaotic, I guess I just want to know exactly what
“Activate recently added devices” means…What is an ACTIVATED device?

And how do I stop Unifi from adding MORE devices into my device-list, but still keep track of the existing ones…

I’ve come looking for this answer to

Me too, this is really bad :frowning_face:

The last few releases all of my presence detection automations are broken because of the changes in this feature. Why is known_devices.yaml not used anymore? How do I blacklist certain devices? How do I customize their photos?

The answers aren’t really very satisfying but…

you can set up the unifi tracker to not track certain types of devices thru the config. I’ve heard reports that it doesn’t work as advertised. And I’ve got the problem that, even if it worked correctly, a bunch of my wifi devices show as wired so those devices wouldn’t be tracked. So it wouldn’t be good for me.

To customize the picture you can just use the normal method of customizing entities by using the “customize:” section in your configuration.yaml (or maybe thru the customize area of the UI, but I don’t use it so I can’t confirm how to do that).

And to deal with all of the extra entities in your states you can select each entity in the entity registry and turn off the “enable entity” switch. It will still show up in the entity registry list but not as an entity in your states list.

Lastly, you can override the new entity_id back to the old entity_id in the entity registry as well so that you can get all of your existing automations to work again with the old entity_id’s.

I’m working through UniFi issues on github. With hass 0.100 hopefully the wireless clients going wired have been managed.

So how unifi and home assistant will work forward is that even if you configure integrations to not track certain stuff they will be added to entity registry as disabled entities. From there you can just enable what few entities you are interested in.

Try this out and share your experiences

Will there be an option to “hide disabled entities” that are in the entity registry?

I think that what seemed to be at least half of the complaints (or maybe I’m just projecting) is that not only do you end up getting a tone of tracked entities but even if you disable them you still end up with a ton of disabled entities that aren’t wanted in the entity registry.

But thanks for taking the time to work on this.

Yes. Hiding disabled entities in entity registry has been added to hass 0.100 release

2 Likes

Cool! thanks!

I am experiencing the wireless clients disappearing issue with Unifi. Making my device tracking unreliable.
Thanks for all of your work though, it is appreciated.

Please try out the 0.100 beta so we can make sure it works as good as possible

Turns out that I had DB-problems with my unifi installation that caused additional MACs to appear randomly (quite interested in how db-corruption causes that…), so once I repaired that, things have improved.

Cant say that I have thoroughly understood the meaning of “Wont add new devices if they are inactive”.

How is a device “inactive”? If it is inactive, how come its been detected as a new device?

Can I safely disable “Track network devices” and only loose state of my switches and APs?

Disabled devices are disabled. If you’ve configured that UniFi shouldn’t track devices they will be added as disabled to entity registry but will not be a part of the state machine

Sorry to dig up an older thread, but is there a way to use the unifi integration to notify of new network devices?

I used to have an automation that used the known_devices.yaml, but that is now depreciated.

TIA

mb

EDIT:

This was the automation. Is there a Unifi event?

  - alias: System - New device connected
    initial_state: true
    trigger:
      - platform: event
        event_type: device_tracker_new_device
    action:
      - service: notify.pb
        data_template:
          message: >
            New device:
            {{trigger.event.data.host_name}}
            ({{trigger.event.data.entity_id}})
            Mac: {{trigger.event.data.mac}}
          title: Home Assistant
1 Like

Wanted to share this here. I was still having issues with “junk” mac addresses cluttering both my known devices in the Unifi controller as well as the Home Assistant integration.

I adapted a script that can be run in cron daily with python3 purge_clients.py to drop junk mac addresses from the known devices (devices that have 0 rx/0 tx packets and do not have a set ip address).

2 Likes

Superb! I created a script to clean them out from .storage/core*entities instead, but this is of course even better!

Mind sharing?

No, I’d happily share it, but its still in somewhat of a work-in-progress state, since I built is as a part of learning python to begin with.

So if you dont mind, I’d like to try to clean it up a bit first!

Hey guys!

Im looking into making the integration automatically removing clients the user chooses to “Forget” in UniFi. This will hopefully smoothen things out a bit for you.

2 Likes

It will certainly be useful, but in my case I’ve got numerous MACs occuring in my network every day, so there simply isnt time to manually login to forget devices.

(I somewhat still believe there is a bug in unifi, but thats another story. I just wish they could add the feature of blocking these messages, since they have a unique characteristic)

It certainly is, one of many…