Unifi Network: Failed to connect

I had this issue for a few months but now it works. I removed all unifi from HA, made sure everything on my dream machine pro is up to date, restart dream machine, restart HA, reinstall on HA and Bob’s your mother’s brother it’s done. It works perfectly well, don’t accuse people of poor tested code it’s unfair and gets you nowhere

I’ve tried uninstall etc… still not dice here:

2022-09-16 11:05:17.482 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.1: Call https://192.168.1.1:443/api/auth/login received 404 Not Found

Having the same problem here. Is there a solution already?

Im having the same problem.

File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 228, in _request
raise ResponseError(f"Call {url} received 404 Not Found")
aiounifi.errors.ResponseError: Call https://192.168.1.1:443/proxy/network/api/self/sites received 404 Not Found

Cant setup new Unifi integration. Last version of HA, Unifi - Cloud key 1, Security gateway (both with old firmware). But on older version of HA it works ok.

Just begun having this problem after updating to 2022.12.5 I’ve been having soooo many API, Websocket and Add-On problems since 2022.12.0. A bit of a mess of a release.

Also not able to connect 12.7 ha to cloud key 2

Same issue.

Unifi controller: 7.3.76 (Build: branch_7.3.76_19582_M) running on Mac OS 13.1
Home Assistant 2022.12.8 Supervisor 2022.12.1 Operating System 9.4 Frontend 20221213.1 - latest

I was having the same issue and came across this thread. I have a CloudKey Gen2 and after trying a lot of different things, updating it to the latest UnifiOS firmware followed by powering off and back on resolved the issue for me.
Other things I did were:

  • reset the CloudKey local username/password
  • reboot the HA host machine
  • update the Unifi USG

After updating the CloudKey it still didn’t work until powering off and back on. I’m not sure if any other steps contributed to the solution but figured I would what I did.
I hadn’t used this integration previously, and I was already on HA 2022.12.8

For anyone facing this issue while hosting the Unifi Controller in Home Assistant itself, change the port from 443 to 8443.

I know this isn’t strictly an answer for many in this thread, however this thread is the main page to show in search results for issues like this.

3 Likes

Wow, for an integration that used to have “Platinum” badge in the repository, this is some really nasty behaviour. Thank you for saving my time, as I would lose at least an hour more tweaking the unifi settings :hugs:

Solved for me by adding and using a local super admin.
Using the ui.com email user gave me the failed to connect error.

Go to Ubiquiti Account
→ «UniFi OS» button (server with a cog wheel displayed under your router)
→ «Admins & Users» in the left menu
→ «Add Admin» (+ sign upper right)
→ Check «Restrict to local access only»
→ Fill in the rest of the details

4 Likes

Thank you! This finally helped!

I had the same issue today, after I migrated my Unifi-Controller to the Unifi-NetApp. For somehow reason the integration cannot connect to the DNS name, I had to use the IP-address of the host.

In terms of DNS, I still struggle to get the Unifi-NetApp running with traefik but this is not the topic.