core icon indicating copy to clipboard operation
core copied to clipboard

Failed to Connect Unifi network integration

Open tiagonmas opened this issue 1 year ago • 1 comments

The problem

I have installed Unifi Controller as a Home Assistant Add on that is working on a RPI (https://192.168.1.65:8443/). The contrller works fine but when I try to install the Unifi network integration I always get "Failed to Connect". I'm already using a local admin to bypass multi factor authentication. I'm putting the host as 192.168.1.65 ...

Any idea on how to connect the integration ?

What version of Home Assistant Core has the issue?

core-2024.10.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

unifi

Link to integration documentation on our website

https://www.home-assistant.io/integrations/unifi/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

024-10-14 11:47:32.582 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.65: Error requesting data from https://192.168.1.65:443: Cannot connect to host 192.168.1.65:443 ssl:False [Connect call failed ('192.168.1.65', 443)]

Additional information

No response

tiagonmas avatar Oct 14 '24 10:10 tiagonmas

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)

home-assistant[bot] avatar Oct 14 '24 10:10 home-assistant[bot]

I have the same problem with my local Unifi controller (I am not sure for how long, sorry...).

Looking at a nework capture:

  • HA initiates the TCP connection
  • The Unifi controller accepts the TCP connection
  • HA sends its TLS Client Hello
  • (in my capture there is a TCP retransmission of the Client Hello after 0.2 s)
  • The Unifi controller sends a TCP reset

I had a quick look at the Unifi controller logs on its docker container but could not see any error unfortunately.

cdavidc avatar Oct 14 '24 17:10 cdavidc

+1 on this

noozo avatar Oct 16 '24 11:10 noozo

screengrab of the error. SSL should not be validated image

tiagonmas avatar Oct 16 '24 14:10 tiagonmas

+1

nickgarrard avatar Oct 16 '24 15:10 nickgarrard

I had to change port to 8443.

78andyp avatar Oct 16 '24 18:10 78andyp

Same issue Tried ip, host, all ports, all combinations

Super frustrating that the input field are demented forcing me to fill in the username and password every single time I try to use this integration

Thijxx avatar Oct 16 '24 18:10 Thijxx

Same issue here. But I just updated to Home Assistant OS 13.2 from version 12.3, so a big OS update.

My other versions are: Core: 2024.5.4 Supervisor: 2024.10.3

So this issue has to do with the OS update, because my core didn't change.

ps. After updating Core to 2024.10.4 it still doesn't work, but I expected that.

Krilo89 avatar Oct 27 '24 11:10 Krilo89

screengrab of the error. SSL should not be validated image

Did you try setting the port to 8443 as you stated was the correct port in your first post?

Kane610 avatar Oct 27 '24 19:10 Kane610

I had to use port 443 to be successful.

hs82h avatar Oct 28 '24 18:10 hs82h

I had to use port 443 to be successful.

what do you mean @hs82h ? 443 is the default per the image above ...

tiagonmas avatar Oct 29 '24 10:10 tiagonmas

Have the same issue here. My Unifi network built in PVE and found it need to have MFA log in Authentication now. Didn't remember I need to do that before.

image

b6mh3 avatar Nov 05 '24 23:11 b6mh3

Have the same issue here. My Unifi network built in PVE and found it need to have MFA log in Authentication now. Didn't remember I need to do that before.

image

The integration documentation is updated on how to use it with regards to accounts, have you read the documentation?

Kane610 avatar Nov 06 '24 13:11 Kane610

After checking the documentation and the issue here https://github.com/home-assistant/core/issues/117158 I can't find any place which has the option "Restrict to local access only" even in the legacy interface.

image image

Have the same issue here. My Unifi network built in PVE and found it need to have MFA log in Authentication now. Didn't remember I need to do that before. image

The integration documentation is updated on how to use it with regards to accounts, have you read the documentation?

b6mh3 avatar Nov 07 '24 08:11 b6mh3

After checking the documentation and the issue here https://github.com/home-assistant/core/issues/117158 I can't find any place which has the option "Restrict to local access only" even in the legacy interface.

b6mh3 you might have an old interface. what is the version ? are you using an old cloud key ?

tiagonmas avatar Nov 08 '24 10:11 tiagonmas

Actually, for me switching to legacy interface was the only way to setup a local account. I am using self hosted server as a HA addon.

dziedzic99 avatar Nov 12 '24 03:11 dziedzic99

I don't have that local account option anymore since it's synced with ui.com. Also legacy UI on the latest unms doesn't show tha option. 2FA should be mandatory for security so this plugin needs to be updated to allow entering a code.

jzielke84 avatar Nov 13 '24 19:11 jzielke84

I don't have that local account option anymore since it's synced with ui.com. Also legacy UI on the latest unms doesn't show tha option. 2FA should be mandatory for security so this plugin needs to be updated to allow entering a code.

How are you running unifi? Self hosted or through unifi os?

Kane610 avatar Nov 13 '24 19:11 Kane610

How are you running unifi? Self hosted or through unifi os?

self-hosted

jzielke84 avatar Nov 13 '24 19:11 jzielke84

Follow the same proceduren as https://github.com/home-assistant/core/issues/128348#issuecomment-2469538790

I have no plans to support 2Fa tokens at the current time

Kane610 avatar Nov 13 '24 19:11 Kane610

Follow the same proceduren as #128348 (comment)

I have no plans to support 2Fa tokens at the current time

Like I said, the option is not available once you’re syncing with ui.com. Since you’re not planning to support it I guess that makes this integration obsolete for many people who won’t sacrifice security for the sake of an outdated plugin.

jzielke84 avatar Nov 13 '24 22:11 jzielke84

@jzielke84 - I also ran into this issue with 2FA/MFA with self-hosted, but was able to get an account to work with a local login without MFA by going to the old UI, and then toggling this to 'OFF'.

image

dimatx avatar Nov 13 '24 23:11 dimatx

After checking the documentation and the issue here https://github.com/home-assistant/core/issues/117158 I can't find any place which has the option "Restrict to local access only" even in the legacy interface.

b6mh3 you might have an old interface. what is the version ? are you using an old cloud key ?

I run unifi network (8.0.26) on my local VM: image image

And no "Restrict to local access only" option in default or legacy interface.

default

image

legacy

image

b6mh3 avatar Nov 14 '24 00:11 b6mh3

Update:

I created a new admin in the legacy interface with no "Restrict to local access only" execution, and it can work now!

image

image

After checking the documentation and the issue here https://github.com/home-assistant/core/issues/117158 I can't find any place which has the option "Restrict to local access only" even in the legacy interface.

b6mh3 you might have an old interface. what is the version ? are you using an old cloud key ?

I run unifi network (8.0.26) on my local VM: image image

And no "Restrict to local access only" option in default or legacy interface.

default

image

legacy

image

b6mh3 avatar Nov 14 '24 00:11 b6mh3

Thank you @dimatx and @b6mh3! This has been driving me bonkers. I migrated from an USG with the controller hosted in HomeAssistant as an Addon to a Unifi Dream Machine Pro hosting the console and hadn't been able to get this integration working since.

For the UDM I had to disable Remote Access in the Console Settings as a whole. Add the admin, and auth the integration to get it working. After it was connected I was able to re-enable Remote Access.

image

meagerfindings avatar Nov 14 '24 04:11 meagerfindings

The last comments are great, but not related to the issue. It is explaining how to create a local user in Unifi. This issues is after having a local user, I am not able to connect to unifi from home assistant ... getting the error seen here: https://github.com/home-assistant/core/issues/128348#issuecomment-2417075719

tiagonmas avatar Nov 14 '24 12:11 tiagonmas

@tiagonmas I apologize if they are indeed tangential. I was getting that exact same error until I did the steps above.

meagerfindings avatar Nov 14 '24 12:11 meagerfindings

The last comments are great, but not related to the issue. It is explaining how to create a local user in Unifi. This issues is after having a local user, I am not able to connect to unifi from home assistant ... getting the error seen here: https://github.com/home-assistant/core/issues/128348#issuecomment-2417075719

Your post says your Unifi is running on your RPi on 8443, but your error from HA says 443. Are you putting in 8443 in HA prompt?

dimatx avatar Nov 14 '24 13:11 dimatx

The problem is related with the 2FA, when I try to login in the integration it says authentication not valid but at the same time I get a 2FA email with the code but there is no place to enter it. That means that the console requires the code, and probably sends a status of waiting for 2FA but for the integration anything different of 200 I suppose is not valid and shows the error.

SirMartin avatar Nov 17 '24 12:11 SirMartin

I'm also unsure what to do now. Did an upgrade to 2024.11.2 and now I can't connect my unifi integration. I run a self hosted install on the HA machine, which is addressable through local network 192.168.1.200:8443 and also with a hostname on my domain.

When I try to connect from a browser in the local network to the IP address I have to do MFA, and when I connect to the external adress (which is a nginx proxy to the exact same internal IP address) I can connect "normally" w/o MFA.

Needless to say, that neither of the two ways works to get the unifi integration to connect. Connecting to the ipaddress:8443, and to external address I receive "invalid authentication". Any idea what to do?

iz3man avatar Nov 20 '24 09:11 iz3man