Unifi: 401s and MFA spam

My Unifi integration appears to be broken. I set up the integration with a local only admin level user account forever ago, but Unifi updated and now I keep getting MFA emails from Unifi.

HA version: 2025.1.1, problem started months ago though.

My logs are full of these (note the 12002 occurrences :upside_down_face:) :

Warning:

(12002 occurrences)
Last logged: 6:48:18 AM

Error:

(2 occurrences)
Last logged: 6:48:13 AM

Error setting up entry Default for unifi
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 640, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/unifi/init.py”, line 52, in async_setup_entry
await hub.initialize()
File “/usr/src/homeassistant/homeassistant/components/unifi/hub/hub.py”, line 88, in initialize
await self.entity_loader.initialize()
File “/usr/src/homeassistant/homeassistant/components/unifi/hub/entity_loader.py”, line 81, in initialize
await self._refresh_api_data()
File “/usr/src/homeassistant/homeassistant/components/unifi/hub/entity_loader.py”, line 102, in _refresh_api_data
await self._refresh_data(self.api_updaters)
File “/usr/src/homeassistant/homeassistant/components/unifi/hub/entity_loader.py”, line 88, in _refresh_data
results = await asyncio.gather(
^^^^^^^^^^^^^^^^^^^^^
…<2 lines>…
)
^
asyncio.exceptions.CancelledError

You said forever ago?

If you have not created a local only account on your unifi gear then that’s the issue. (your old one may be a cloud account you never use in the cloud. If it has an email address it’s cloud.)

cloud account requires MFA. Integration doesn’t work with mfa. (changed mid last year) solution is create a local account on your gear that never connected to cloud and use those creds to connect the integration.

My HA account for Unifi has:

:white_check_mark: Restrict to Local Access Only

And on the user list, it’s the only one without an email.

I just deleted the entire integration and went through the wizard again, and it seems to all be working.

1 Like

Off and on again - niice!