Can't Connect to Unifi Controller

I getting an error connecting to my unifi controller - “Failed to connect”

Controller is running 6.3.51, with a FQDN and lets encrypt certificates, it is on an externally hosted VM, I’m also using IPTABLES to forward port 443 to 8443 and have tried on both ports and with and without https:// in the host field

The log message is as below, which is a little sparse, even with the debugging enabled…

Logger: homeassistant.components.unifi
Source: components/unifi/controller.py:506
Integration: Ubiquiti UniFi (documentation, issues)
First occurred: 9:44:12 PM (4 occurrences)
Last logged: 10:20:11 PM

Error connecting to the UniFi controller at unifi.XXXXXXXXX :
Error connecting to the UniFi controller at https://unifi.XXXXXXXXXXX : Error requesting data from https://unifi.XXXXXXXXXX : Cannot connect to host https:443 ssl:default [Try again]

Hey! I have exactly same problem when trying to setup unifi integration. My controller is running on same raspberry as haos, but I got same error when I tried running controller on different computer.

Error connecting to the UniFi controller at https://192.168.1.2: Error requesting data from https://192.168.1.2: Cannot connect to host https:443 ssl:default [Try again]

After a long time I finally figured this out. It was down to have IPv6 on HA, but not the Unifi Controller. Remove IPv6 from HA or adding it to the Unifi Controller fixed the problem.

where do you check this?

On the browser I can connect fine to https://192.168.1.1 (just receive the security warning)

but on HA I recive this in LOG

if on a browser I put this
https://192.168.1.1/api/auth/login

receive


method not allowed

Is this what you’re looking for?

http://homeassistant.local:8123/config/network

image

didn’t work for me.