Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unifi Network integration fails to setup #117158

Closed
mck165 opened this issue May 9, 2024 · 29 comments
Closed

Unifi Network integration fails to setup #117158

mck165 opened this issue May 9, 2024 · 29 comments

Comments

@mck165
Copy link

mck165 commented May 9, 2024

The problem

The integration has been working fine for over 2 years. Now I am not able to load the configuration even after creating a new local user in Unifi OS and using those login credentials

What version of Home Assistant Core has the issue?

2024.5.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 Network

Link to integration documentation on our website

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

Diagnostics information

home-assistant_unifi_2024-05-09T20-15-57.791Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented May 9, 2024

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)

@Kane610
Copy link
Member

Kane610 commented May 9, 2024

With what change did you experience this. What version of Unifi app and os are you running

@mck165
Copy link
Author

mck165 commented May 9, 2024

With what change did you experience this

Unfortunately I am not sure when it happened as I do not rely on too many automations for Unifi

@Kane610
Copy link
Member

Kane610 commented May 10, 2024

What version of Unifi app and os are you running

@mck165
Copy link
Author

mck165 commented May 10, 2024

What version of Unifi app and os are you running

Unifi OS v3.12.12 and Network 8.1.127

@MackKaufmann
Copy link

MackKaufmann commented May 10, 2024

Same here (HA Docker):

Logger: homeassistant.components.unifi
Source: components/unifi/hub/api.py:76
Error connecting to the UniFi Network at 192.168.1.1:

Seems like the port is missing after IP when connecting.

Connecting should be: 192.168.1.1:443

@Justsomedong
Copy link

Justsomedong commented May 13, 2024

I was / am having the same issue. Created new Local User on UDMSE after Early Access (I know, likely to break things!) install broke integration with needing new auth. New local account didn't solve after reboot of both devices.

Deleted integration, but on re-add using the new local account I receive "Unknown Error Occurred" or "Invalid Auth"

Network integration works perfect with same u/p.

Unifi OS: 4.0.3
Protect: 4.0.7
HA: 2024.5.3

@Kane610
Copy link
Member

Kane610 commented May 13, 2024

Lets keep this issue to be about Network, protect has its own implementation

@Kane610
Copy link
Member

Kane610 commented May 13, 2024

Based on this comment, does Network work for OP?

I was / am having the same issue. Created new Local User on UDMSE after Early Access (I know, likely to break things!) install broke integration with needing new auth. New local account didn't solve after reboot of both devices.

Deleted integration, but on re-add using the new local account I receive "Unknown Error Occurred" or "Invalid Auth"

Network integration works perfect with same u/p.

@Justsomedong
Copy link

Lets keep this issue to be about Network, protect has its own implementation

Sorry about that! Jumped in wrong repo!

@mck165
Copy link
Author

mck165 commented May 13, 2024

Based on this comment, does Network work for OP?

I was / am having the same issue. Created new Local User on UDMSE after Early Access (I know, likely to break things!) install broke integration with needing new auth. New local account didn't solve after reboot of both devices.
Deleted integration, but on re-add using the new local account I receive "Unknown Error Occurred" or "Invalid Auth"
Network integration works perfect with same u/p.

I have not upgraded to early access. Should I try deleting and then reinstalling the integration again?

@mck165
Copy link
Author

mck165 commented May 13, 2024

Just a random thought I had as I continue to research...starting to think that the issue may have started when I enabled MFA...

@MackKaufmann
Copy link

Just a random thought I had as I continue to research...starting to think that the issue may have started when I enabled MFA...

The integrations expect local accounts which are not required to have 2FA enabled.
See this thread https://community.home-assistant.io/t/2fa-added-to-the-unifi-ubiquiti-component/293031/10

@mck165
Copy link
Author

mck165 commented May 13, 2024

Just a random thought I had as I continue to research...starting to think that the issue may have started when I enabled MFA...

The integrations expect local accounts which are not required to have 2FA enabled. See this thread https://community.home-assistant.io/t/2fa-added-to-the-unifi-ubiquiti-component/293031/10

Thanks. I just checked and I do have a local user setup for the integration

@MackKaufmann
Copy link

Hey @Kane610, did you check on this: #117158 (comment)?

@janegilring
Copy link

janegilring commented May 13, 2024

I faced the same issue when creating a user for Home Assistant and found the following workaround:

  • Go to Settings -> System -> Advanced -> Show more -> Interface: Legacy
  • Go to the admin area in the legacy user interface and provision a new local user
  • Revert to the new user interface

I would assume provisioning users via SSH/CLI could be an alternate approach when the legacy interface is removed at some point.

@Kane610
Copy link
Member

Kane610 commented May 14, 2024

Same here (HA Docker):

Logger: homeassistant.components.unifi Source: components/unifi/hub/api.py:76 Error connecting to the UniFi Network at 192.168.1.1:

Seems like the port is missing after IP when connecting.

Connecting should be: 192.168.1.1:443

Good observation, the log could be clearer, the format of the log is <host>: <error message> so its not missing, only saying that the error message was empty

@Kane610
Copy link
Member

Kane610 commented May 14, 2024

As most people have reported it is working on both 3 and 4 right now I would make sure to properly restart all equipment to make sure its back in a known state

@MackKaufmann
Copy link

As most people have reported it is working on both 3 and 4 right now I would make sure to properly restart all equipment to make sure its back in a known state

Done already: Pulled new HA Docker image, deactivated HACS and all its integrations. Restarted UDM Pro, deactivated any firewall rules. Same result:

ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.1:

By the way: the same problem exists with @homeassistant/components/fritzbox

@seracc
Copy link

seracc commented May 16, 2024

Having the same issue trying to set up the integration for the first time. Getting the following error message:

2024-05-16 09:36:38.035 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.36.1:

Running HA on a Raspberry Pi 4
Core
2024.5.3
Supervisor
2024.05.1
Operating System
12.3

Unifi Network is on 8.1.127 running on a UDM-Pro running OS version 3.2.12.

I have restarted the UDM-Pro, HA, and my Switch Pro 24 PoE and nothing changes. I can ping 192.168.36.1 from HA as well. Also tested the login credentials of the local admin I created and that works just fine.

@Kane610
Copy link
Member

Kane610 commented May 16, 2024

By the way: the same problem exists with @homeassistant/components/fritzbox

Probably unrelated, but the issue is on your side as it can't connect to the address.

@Kane610
Copy link
Member

Kane610 commented May 16, 2024

Having the same issue trying to set up the integration for the first time. Getting the following error message:

2024-05-16 09:36:38.035 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.36.1:

Running HA on a Raspberry Pi 4 Core 2024.5.3 Supervisor 2024.05.1 Operating System 12.3

Unifi Network is on 8.1.127 running on a UDM-Pro running OS version 3.2.12.

I have restarted the UDM-Pro, HA, and my Switch Pro 24 PoE and nothing changes. I can ping 192.168.36.1 from HA as well. Also tested the login credentials of the local admin I created and that works just fine.

Are you sure its the correct address, not too common using a high number as 36

@seracc
Copy link

seracc commented May 16, 2024

Having the same issue trying to set up the integration for the first time. Getting the following error message:
2024-05-16 09:36:38.035 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.36.1:
Running HA on a Raspberry Pi 4 Core 2024.5.3 Supervisor 2024.05.1 Operating System 12.3
Unifi Network is on 8.1.127 running on a UDM-Pro running OS version 3.2.12.
I have restarted the UDM-Pro, HA, and my Switch Pro 24 PoE and nothing changes. I can ping 192.168.36.1 from HA as well. Also tested the login credentials of the local admin I created and that works just fine.

Are you sure its the correct address, not too common using a high number as 36

Yes, I use some odd numbers so I can tell what site is what and I don't end up accidentally making changes to the wrong site if I forget to switch between UDM consoles.

@MackKaufmann
Copy link

The error seemed to be related to QNAP Container Station (Docker), when running HA in Host mode docker (lxcbr0).

After the most recent firmware update, the connection can be re-established.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@coreywillwhat
Copy link

I've been having this issue for about the same amount of time as others here. Getting 403 Forbidden upon login attempt. Agree it also appeared around the same time I setup MFA for my cloud users. I have a super admin user setup with restrict to local access only for HA access.

Here is the log for integration reload:

2024-06-12 07:40:26.989 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/api/auth/login received 403 Forbidden
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/rest/user received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/stat/device received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/rest/dpiapp received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/rest/dpigroup received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/rest/portforward received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/self/sites received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/stat/sysinfo received 401 Unauthorized
2024-06-12 07:40:26.990 WARNING (MainThread) [homeassistant.components.unifi] Exception on update Call https://192.168.1.1:443/proxy/network/api/s/default/rest/wlanconf received 401 Unauthorized
2024-06-12 07:40:26.990 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Default for unifi
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/unifi/__init__.py", line 52, in async_setup_entry
    await hub.initialize()
  File "/usr/src/homeassistant/homeassistant/components/unifi/hub/hub.py", line 92, in initialize
    self.is_admin = self.api.sites[self.config.entry.unique_id].role == "admin"
                    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiounifi/interfaces/api_handlers.py", line 167, in __getitem__
    return self._items[obj_id]
           ~~~~~~~~~~~^^^^^^^^
KeyError: '629555bcb983050869acb2a6'

and the log for integration (re)setup:

2024-06-12 07:47:44.781 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 403 Forbidden
2024-06-12 07:48:02.357 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 403 Forbidden

@Kane610
Copy link
Member

Kane610 commented Jun 12, 2024

I've been having this issue for about the same amount of time as others here. Getting 403 Forbidden upon login attempt. Agree it also appeared around the same time I setup MFA for my cloud users. I have a super admin user setup with restrict to local access only for HA access.

Accounts with MFA is not supported by the integration.

@coreywillwhat
Copy link

Thanks for the quick response! I've disabled MFA for my account and still getting the same error in my logs. I'll try to give it some time and reboot the UDMSE to see if it works.

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants