Before I make an edit - to the bug Robert - It’s about counting any foriegn entity on a given network - the way it works now we cont get device trackers for new nodes. Guests or no - unless we go in and manually enable each one.
THat has many uses - i cant count them all - but the one MOST people use them for are How many unknowns are on my network, It was easily templatable as a counter device tracker where integration = unifi and XYZ=some other condition to filter down by network or segment or subnet or otherwise.
I just want the option for the trackers to autocreate enabled like they used to. Default off is fine but I cant find how turn it back on manually (with user knowledge of the potential consequences - you should see what the BLE tracker does to your device trackers). I may have missed something in the last few releases?
If its a script workaround that sits and looks for new disabled device tracker entities with integration unifi and flip them on?
FYI this is an architectural decision in Home assistant and the behaviour of all device trackers, though it might have been because people complained about getting too many entities from the UniFi integration originally.
The only way to get them autoenabled nowadays is if the device is already in the device registry, then the device tracker will be automatically enabled. There is no logic to change that behaviour right now. That would be a feature request for home assistant in general.
Rather we look into alternative solutions like a sensor per SSID or something
I read your bug report, and you list this last working in 2022.10, and it’s listed as a ubiquiti bug. From my brief research, this was a change made in HA, not Ubiquiti, and it was made in 2022.2. See: 2022.2: Let's start streamlining! - Home Assistant
The fact that we have to create a “feature request” for them to enable a feature that used to work that we didn’t want disabled in the first place is a load of garbage. LOL
At a minimum, being able to track the number of clients currently connected to a specific SSID would theoretically resolve my present issue, so long as the count updated in a timely fashion (near-realtime would be splendid!).
I make bad decisions all the time, living on the edge . But this is not my decision.
There are no auto clean up AFAIK, the configuration options still apply (will be removed later) though if options are enabled to provide device trackers then entities should be available as disabled in the entity registry.
Oh, I didn’t mean to imply that you were the dev that made the decision - I know this is an HA change, not a change to the integration.
As for the auto-cleanup… All I know is I see a whole bunch of clients in my UI console, and when I go look for the associated entities in HA the only thing I see are uptime sensors. I do not see device trackers for those clients listed at all, in any state, enabled or disabled.
Further, that’s a good point. In the integration itself you have the option to track network devices or not. Don’t want a million trackers? Don’t enable the option. Why the HA devs had to break this is really beyond comprehension for me at this point.
I’ve been doing more digging on this, and found several things. I’m guessing that @Robban is Kane, based on the same avatar in use? If not, my apologies. But continuing with that assumption: In this thread: Newly tracked devices are not enabled in spite of system option · Issue #65188 · home-assistant/core · GitHub a lengthy discussion was had about this very issue. The fact that device trackers are DELETED was also discussed, and verified, in that conversation.
However, most importantly - it would appear that there is a workaround for this issue, with the unifi integration at the very bottom of the thread. The claim is that if you enable uptime sensors for network devices, the device trackers will be created and will be enabled.
There is, however, some ambiguity in the proposed solution. It would appear in the thread that there were a bunch of disabled device trackers, and the user wanted them enabled, so they flipped on uptime, which enabled the device trackers and then they disabled uptime, which removed the uptime entities but left the device trackers enabled. I’m curious about leaving uptime enabled permanently, and if that means that newly-created device trackers will, in fact, be created enabled.
I’ll try to test later today if possible, but figured I’d toss this in here in case someone else has time to test before I do.
I guess I don’t understand what you mean, when you say “if the device registry entry for the device exist”… I understood that to mean a device that I manually created a device registry for in HA? There are TONS of devices pulled in from the Ubiquiti integration that I have not manually registered in HA. Every single laptop, computer, printer, all manner of stuff.
Can you go a bit more into detail about what you mean when you say “if the device registry entry for the device exist”? Perhaps I’m lacking some type of knowledge or vocabulary there…
FYI, I’ve been using the HACS Unifi Counter Sensor until this issue gets resolved. It gives me a count of the number of devices on each SSID and AP, along with a total number of devices. I can use the Guest network count to enable/disable guest mode in HA.
A device registry entry describes a physical device, it can be linked to multiple entities and multiple integrations.
Device tracker entities will only be created if another entity has already registered a device registry entry, be it from a different entity from UniFi platform or from another integration.
If no entry exist then no device tracker entity gets created.
Oh thank you! I didn’t know about that HACS extension. I’m testing it but it looks promising, and much better than polluting your HA with useless device trackers
I recently tried this integration. While it does connect to my controller, and returns the count for each network (like the rest of this thread, I am seeking a count of my guest network), what I found is that the count never goes down until I manually login to the controller and tell UniFi to forget the device.
I merely need a count of active devices on my guest network, besides the gateway, if the count is greater than 0, I will use that to enable guest mode in our house, otherwise disable it. This obviously won’t work since the count never goes down. At least it didn’t for me.
It sounds like something isn’t working correctly for you then. For me it works exactly as you expect it to, but remember there is a timeout period for every device. So you can’t just turn off Wi-Fi on your phone and expect it to immediately show the count go down by one. It takes a few minutes.
I am perfectly aware that the response would not be instantaneous. A change within an hour would be perfectly acceptable (length of the DHCP lease). The fact is, that it does NOT work properly using the unifics integration, either because of something in the integration or something in UniFi.
I connected a single device to my guest work and verified that the count increased from 0 to 1.
That took less than a minute.
I disconnected the device from that network, and waited a full 24 hours, the number of devices on that network continue to remain at 1. Either the integration has an issue, or the issue is in UniFi. more than a full 24 hours after the device showed up on the target network, after the DHCP lease had long since expired, the client is still “known” by the controller and still shows in the quantity of devices using the integration.
The count does not go back to 0 on it’s own, until I manually ‘forget’ the device in the controller as I noted in the post.