core
core copied to clipboard
Unifi integrations require reconfiguration after reboot
The problem
I have both UniFi Network and UniFi Protect integrations and after a restart of the Home Assistant I sometimes need to reconfigure one of the integrations. Sometimes one of the 2, sometimes both, somtimes none. This should have been fixed in #63994 (from 12 january 2022) but I still have it in my current setup.
Both UniFi Network and UniFi Protect run on a Ubiquiti UniFi Cloud Key Gen2 Plus, currently running UniFi OS 3.2.7. I did a fresh install of HA Core 2024.1.2 on Python 3.11.7
What version of Home Assistant Core has the issue?
core-2024.1.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant Core
Integration causing the issue
UniFi Network UniFi Protect
Link to integration documentation on our website
https://www.home-assistant.io/integrations/unifi/ https://www.home-assistant.io/integrations/unifiprotect/
Diagnostics information
config_entry-unifi-c23473ba86cb80fdbabd69e1a1a267bd.json.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
See my comments below for more on log entries
Additional information
I checked the .storage/core.config_entries file and in the unifi domain, the correct password is stored in cleartext
Hey there @kane610, mind taking a look at this issue as it has been labeled with an integration (unifi
) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of unifi
can trigger bot actions by commenting:
-
@home-assistant close
Closes the issue. -
@home-assistant rename Awesome new title
Renames the issue. -
@home-assistant reopen
Reopen the issue. -
@home-assistant unassign unifi
Removes the current integration label and assignees on the issue, add the integration domain after the command. -
@home-assistant add-label needs-more-information
Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. -
@home-assistant remove-label needs-more-information
Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
unifi documentation unifi source (message by IssueLinks)
At startup of HA-Core, I get the following message:
2024-01-11 10:35:48.436 WARNING (MainThread) [homeassistant.components.unifi] Access forbidden to UniFi Network at <UniFi hostname>, check access rights: Call https://<UniFi hostname>:443/api/auth/login received 403 Forbidden
2024-01-11 10:35:48.436 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Default' for unifi integration could not authenticate
Then the integration (in Settings => Devices & Services) is in a "Reconfiguraiton Needed" or "Failed to set up" state. (Below images of the "Failed to set up" state)
Now, when I reload the integration, it loads succesfully (No changes in configuration, no need to enter a password)
And here are some screenshots from the "Reconfigure" state (this tile is in the Discovered section):
If I click the "RECONFIGURE" button, I need to re-enter my password. In this case, there is also a "Failed to set up" tile in the Configured section:
If I select Reload in the tripple-dot-menu, the integration loads succesfully BUT the RECONFIGURE tile remains in the Discovered section with no way of removing this tile even though the integration is now running fine
Finally, I set logging for homeassistant.components.unifi to debug, rebooted the system and of course, the UniFi Network integration was loaded succesfully, howevere, the UniFi Protect integration was now in RECONFIGURATION/"Failed to set up" state. So, I set logging for homeassistant.components.unifiprotect to debug as well and rebooted the system. Which of course resulted in BOTH integration loading succesfully.
Another reboot caused the UniFi Network integration to load fine but the UniFi Protect integration failed again generating this message in the logging:
2024-01-11 11:15:05.885 WARNING (MainThread) [homeassistant.config_entries] Config entry '***REDACTED*** UCK2P' for unifiprotect integration could not authenticate: Request failed: /proxy/protect/api/nvr - Status: 401 - Reason: {'code': 401, 'message': 'Unauthorized'}
Finally, I disabled the debug logging for UniFi Protect again (UniFi Network still had debug loggin on) and did another reboot. Now, UniFi Protect loaded fine and UniFi Network failed. Unfortunately, there was no debug logging in the log file. The only useful entry was the same as I mentioned my first comment
Please keep separate issues for the different integrations as we're different developers involved.
Try fully restarting your unifi system. This kind of issue is typically resolved by that
Unfortunately, fully restarting (disconnect power) does not solve the issue.
I understand that the 2 integrations might not be managed by the same person, but it seems to be the same issue, which means if one is solved it can be shared so the other can be solved as well.
I ran across this as well a little while back. For me what solved it, was remove both integrations (for me protect and unifi) from HA, restart HA and UniFi, change the password for the HA account in UniFi (probably unneeded, but hey), and readd the integrations in HA.
I ran across this as well a little while back. For me what solved it, was remove both integrations (for me protect and unifi) from HA, restart HA and UniFi, change the password for the HA account in UniFi (probably unneeded, but hey), and readd the integrations in HA.
Been there, done that, but sadly, no dice for me. Still got the same problem.
same same /push
same here
Same here
PR to change behaviour to try reconnect has been merged, you can try out dev or beta coming out this week.