I have a few Unifi products (UDM-Pro SE, UDM 24POE Switch, 2x G4 camera’s) and want to integrate them into Home Assistant. I have the camera’s already working (Unifi Protect) but I want to control my network with the UniFi Network integration.
When adding the integration the setup asks for the Host, username, password and ports. I already set up a local admin account with admin permissions to the network part.
I’m entering the following info:
Host: 192.168.1.1.
Username/password of the local admin account
Port: 443
When pressing save I get the ‘Unknown error occurred’ error. What am I doing wrong?
Make sure your udm is updated to latest stable version of unifi os and network controller. If that doesn’t work you can also try a real shutdown of it and the turn it on again
Found it. I did try several times so my log looks as followed:
Logger: homeassistant.components.unifi
Source: components/unifi/controller.py:513
Integration: UniFi Network (documentation, issues)
First occurred: 12 juli 2022 16:13:18 (4 occurrences)
Last logged: 09:57:41
Error connecting to the UniFi Network at localhost: Error requesting data from localhost: Cannot connect to host localhost:443 ssl:default [Connect call failed (‘127.0.0.1’, 443)]
Error connecting to the UniFi Network at 192.168.2.1: Error requesting data from 192.168.2.1: Cannot connect to host 192.168.2.1:443 ssl:default [Connect call failed (‘192.168.2.1’, 443)]
Error connecting to the UniFi Network at 192.168.1.1: Error requesting data from 192.168.1.1: Cannot connect to host 192.168.1.1:80 ssl:default [[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:997)]
For other who arrive here where this doesn’t work, my issue was different. I have MFA set up on my admin Unifi account which is apparently incompatible with the Unifi Network HA integration. Error log I was getting was:
File “/usr/local/lib/python3.12/site-packages/aiounifi/interfaces/connectivity.py”, line 140, in _request
raise LoginRequired(f"Call {url} received 401 Unauthorized")
You can resolve this by creating a separate admin account in Unifi for Home Assistant to use that does not have MFA turned on.
Note: You can only create local Unifi accounts via the classic Unifi interface. Follow these instructions to create the account:
To turn off the New UI, Settings → System → Legacy Interface → Enable (Ensure this is not ticked, when the tick is removed select Deactivate at the prompt)
Now go to Settings → Admins
Add a new user and select the “Manually set and share the password”, then enter the email address or username and password of your choice and select the role that you want. (If you want to use Super Admin, you have to create the user first and then go back in and edit it to give it Super Admin rights).
Then Turn Back on the New UI
Settings → User Interface → New User Interface. Enable and Apply the Configuration.