Unifi integration stopped working

After updating to to 2022.2.0, I noticed all Unifi device trackers has gone into a failed “restored” state. I deleted the integration, restarted, and added the integration. The integration added perfectly fine in the webUI, but no entities/devices are loaded. As soon as the integration is added, I see the following error in the logs:

2022-02-02 17:35:19 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Home for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 327, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/device_tracker/config_entry.py", line 56, in async_setup_entry
    dev_reg.async_remove_device(device_id)
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 519, in async_remove_device
    device = self.devices[device_id]
KeyError: '3094315ad8804f7895f95a47b6da6d07'

Rolling back to 2021.12 brought back the 9 entities I currently use. So something weird in 2022.2

I canconfirm - I’m seeing the same thing here. I’m going to have to rollback, too.

Working well for me

I had some device trackers not showing up. I enabled the Uptime sensors and then they alll appeared.
I think it might be they way device trackers are now not enabled by default for some devices. It’s in the release notes. It doesn’t say how to enable them though.

I needed to delete the integration, create a new user on unifi (old user was a local super admin, created a limited).

I restarted my udmpro, then restarted ha and readded the integration with the new user to get everything running under 2022.2.

I was getting an error along the lines of “could not connect/find controller” in the HA logs.

1 Like

I’ve dug everywhere looking for how to enable device tracking entities in the new method. Change log says you can do it, but no documentation anywhere on how exactly to do that.

I have 9 wifi devices I am tracking, including several cell phones. I need them to appear in the integration, but documentation doesn’t exist.

Have you tried enabling Uptime Sensors ?

1 Like

Hi,

Click configure on the integration and on the second config page there is a dropdown. Tick the ones you want…I searched for ages too.

image

There are some pretty significant commits in 2022.2.0 that impact Unifi and device_trackers in general.

What version of the controller are you using?

I am having the same issue using 2022.2.9.
Some device trackers are not showing up.

Any suggestions?
Thanks in advance.

Not showing up or disabled. Most trackers are disabled by default. Go to the integration page and click on the unifi entities. It may also show a mac instead of the friendly name.

1 Like

Any updates on this, eg how to enable all trackers by default? I was able to enable them by enabling uptime sensors, then disabling uptime sensors. The trackers remained enabled, however, it is more of a workaround that I might forget to do next time.

1 Like

Same worked for me.

It is incredible how google + forums are good, I’m an old homeassistant user so I wanted to delete some entries created by unifi over the years so I deleted the integration and re-added but I could not enable the tracker unless I tinkered with that box.

Has anyone got the Unifi Network integration working with the latest version of HA and latest version of firmware on the Ubiquity Unifi Dream Router? I cannot even add the integration “Failed to Connect”. I can however add Unifi Protect ok. There must be a bug somewhere.

mine is working the same way it always has… dream machine firmware and HA is up to date.

I wonder if anyone else is still having this problem or does anyone know how to fix it. Last night I restarted HA and how I get “Failed to set up” errors for Unifi Network (Unifi Protect works) Looking at the error log I’ve

2022-12-03 17:13:30 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Default for unifi
File "/usr/src/homeassistant/homeassistant/components/unifi/__init__.py", line 41, in async_setup_entry
File "/usr/src/homeassistant/homeassistant/components/unifi/controller.py", line 311, in async_setup
File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 161, in initialize
File "/usr/local/lib/python3.10/site-packages/aiounifi/interfaces/api.py", line 36, in update
File "/usr/local/lib/python3.10/site-packages/aiounifi/interfaces/api.py", line 44, in process_raw

So far I have deleted the integration and reinstalled, deleted the integration restarted and reinstalled, deleted the integration restarted twice and reinstalled, change the Unifi user name and done the aforementioned again! I’ve had this problem in the past but I cannot remember how I fixed it!

Regards
James

I was having trouble with it until a moment ago. It was working for some time (and was definitely working within the past 30 days). Then it was showing “failed to set up” the last week or two. If I clicked configure it said “UniFi integration is not setup”.
Reloading the integration didn’t help. Restarting HA didn’t help. I was having issues with Protect and Wifiman today so I restarted the UDM Pro. Then I reloaded the integration and it came up right away.