UniFi Network integration - official thread

I want to create a common thread for UniFi Network integration users to help each other and where I will post release notes per release of Home Assistant.

Support questions are ok, but please don’t ping me for support here unless I’m already involved.
If you have serious issues create an issue on GitHub.

Since this summer I’ve started to refactor the library and integration to be in a more maintainable and scalable design, following from the same principles I’ve done with the deCONZ integration. Most inspirations for the redesign has been taken from the aiohue V2 implementation.

Structured release notes communicated promptly I’ve been doing for some time with the deCONZ integration and I feel its time to do for the UniFi integration as well.

Released with Home Assistant 2022.11.3

Released with Home Assistant 2022.11.0


aiounifi releases


To be released with Home Assistant 2022.12.0


aiounifi releases

7 Likes

There has been something bugging me for a long time…

I’ve thought many times about submitting an issue but I’m not 100% sure if it’s working as expected or not.

I thought that the integration was supposed to remove devices from HA if they have been removed from the unifi system.

I have a couple of device tracker entities that were added automatically to HA but there is no device associated with them and the devices themselves have been removed from the unifi controller.

Is that the way it’s supposed to work?

this is the only device that has the MAC as the name in the controller:

image

but here are the two device trackers that exist in HA:

Ironically the first device in the controller from the first pic doesn’t actually show up in HA so it’s pretty inconsistent in both directions.

is there a reason why they haven’t been deleted from the integration?

There is a service to remove old entities but they are not removed automatically, as far as I know.

unifi.remove_clients: UniFi Network - Home Assistant

2 Likes

I think it was working more correctly before the changes to device tracker a year ago.

I want to refrain from revisiting these issues prior to completing the refactorisation of the integration as I hope to solve some bugs through this or that I stumble upon an issue as I’m rewriting code. The implementation has grown in small pieces over a long period of time with varying support in test coverage making it hard to support so it will hopefully all be in better shape afterwards.

image

Just compare the difference between the current switch platform with how it looked a month ago

1 Like

I forgot about that one, yes indeed!

It looks like that service only remove entities from the unifi controller.

at least according to the description.

image

and the docs:

SERVICE UNIFI.REMOVE_CLIENTS

Clean up clients on the UniFi Network application that has only been associated with the Network application for a short period of time. The difference between first seen and last seen needs to be less than 15 minutes and the client can not have a fixed IP, hostname or name associated with it.

So, you tried and it didn’t work?

No. I’m just going by the descriptions above. Which to me seems fairly clear. But of course I could be wrong.

But even if I wanted to try it I’m not even sure what data the service is expecting and in what format. Does it want the hostname, MAC, device tracker entity_id?

there is literally no other information on that service anywhere that I can see except the little bit I posted above.

Please let us know if you try it out and if it helps afterwards

I consistently get these errors in the log, and Network devices show as unavailable.

2022-11-20 00:47:54.143 WARNING (MainThread) [homeassistant.components.unifi] Lost connection to UniFi Network

Is this a known issue?

Not that I’m aware. I think it’s been mentioned by some users. But I’m not sure.

I am getting this error, on two separate HA/Unifi installations. It’s wreaking havoc with my device_tracking (flapping from home/away because I use the device_tracker for person status)

@Robban what is the best way to get you more information about this, turn up logging on [homeassistant.components.unifi] to debug?

  1. Create an issue on home assistant github with as much information as possible. Preferably in sync with the other user with similar issue.
  2. Enable debug logging for unifi integration per instructions in integration documentation and share them privately with me here on the forum

It’s not happening for me any more - no idea what caused it, sorry.

After examining the logs on both HA and the cloud key, I think the cloud key app is crashing and restarting. I’m updating to the most recent minor version of the network app, and will observe again.

Hello all!

Here are the changes released with Home Assistant 2022.12.0

A lot of changes has been merged as part of the complete overhaul of the UniFi integration. Not everything I hoped for got merged though, but there is another release in 5 weeks. The Overhaul aims at making it easier to expand on the integration in the long term, it became really hard to get a good overview of the functionality and some bad design decisions made it hard to evolve the current code base. Some minor thing might break (like needing to reload the integration if changing config entry options) it will be fixed further down the line.

Cheers!

/Robban


For feature requests of the integration post an issue at aiounifi github

3 Likes

Just a follow up to my UniFi Network integration headaches, I upgraded the network application from 7.2.91 to 7.2.95, and rebooted the entire cloud key of one of my two instances, and that seems to have solved the problem I was having with loss of connection between HA and UniFi Network.

1 Like

Hello all!

Another beta is cut and here are the changes coming with Home Assistant 2023.1.0

Progress has been a bit slower this month unfortunately, it’s been hard getting things reviewed and merged. Only one change made it into the January release. Hopefully more changes will come in February.

I’ve gotten requests to buy me a coffee, I’m on Github Sponsors if you appreciate my work.

Cheers!

/Robban


Fixes for 2023.1.1

For feature requests of the integration post an issue at aiounifi github


Changes slated for Home Assistant 2023.2

3 Likes

I’m not sure if this is related, but the integration has lost its connection with the unify controller after an upgrade to 2023.1.7. Nomatter what I do I cannot get it to reconnect. I’ve tried reinstalling the integration and using a different read-only user on the controller, but no effect.

Is there a log anywhere?

Have you restarted your controller properly?