Coder Social home page Coder Social logo

Comments (16)

home-assistant avatar home-assistant commented on June 27, 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)

from core.

BlackRockCity avatar BlackRockCity commented on June 27, 2024

I am seeing the same failed to connect issue in the June release of HAOS/HA. My Unifi controller is remote, but I'm giving the correct credentials as verified by logging into the same hostname on my controller's web GUI.

This is my first time installing it. I've never tried to install the Unifi Integration previously.

Also, I recommend some documentation or a greyed out text in the host field showing example.com because its not clear if a leading https:// is needed in the hostname field.

Thanks for posting this OP.

from core.

XalaTheShepard avatar XalaTheShepard commented on June 27, 2024

I noticed that I forgot to mention that I am running the UniFi controller as a HA Add-on

from core.

leeaash avatar leeaash commented on June 27, 2024

I also meet this problem even I have create a local authentication account. Any tips to resolve this problem?

from core.

XalaTheShepard avatar XalaTheShepard commented on June 27, 2024

In my case, the issue has been solved. I have logged in into both the Unifi controller and HA using the local IP address. Then I have created a local user in the Unifi controller. I deleted the Unifi Network integration in the local HA and afterwards added it again with the credentials of the local administrator account of the Unifi controller. Now I have both 1 local Unifi administrator and 1 remote Unifi administrator, of which the latter has to use the 2FA.

from core.

Kane610 avatar Kane610 commented on June 27, 2024

Do you see any errors in the logs?

from core.

XalaTheShepard avatar XalaTheShepard commented on June 27, 2024

@BlackRockCity and @leeaash , this is a question for your issues as for me the issue has been resolved

from core.

mindstorms6 avatar mindstorms6 commented on June 27, 2024

I've been hitting the same issue recently - however - it seems like my integration got in a bad state and was hitting the login endpoint on the controller too much. From the integration logs, the controller is now returning a 429 Too Many Requests error:

2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.4.1:443) b'<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="icon" href="/favicon.ico?v3" sizes="any"><link rel="icon" href="/favicon.svg?v3" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png?v3"><title>UniFi OS</title><meta name="viewport" content="width=device-width,initial-scale=1"><script>window.UNIFI_OS_MANIFEST = {"model":{"id":"UDW","shortName":"UDW","longName":"UniFi Dream Wall"},"images":{"small":"/assets/images/small.png?udw-2.0.0","medium":"/assets/images/medium.png?udw-2.0.0","large":"/assets/images/large.png?udw-2.0.0","huge":"/assets/images/huge.png?udw-2.0.0"}}</script><script defer="defer" src="/main.1f13cbe8ee4a4f1a0848.js"></script><link href="/main.0e9197a3.css" rel="stylesheet"></head><body><div id="root"></div></body></html>'
2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Talking to UniFi OS device: True
2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://192.168.4.1:443/api/auth/login) post, {'username': 'viewonly', 'password': 'OMITTED', 'rememberMe': True}, {}
2024-06-21 16:35:17.792 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://192.168.4.1:443/api/auth/login) 429 application/json <ClientResponse(https://192.168.4.1:443/api/auth/login) [429 Too Many Requests]>
<CIMultiDictProxy('Server': 'nginx', 'Date': 'Fri, 21 Jun 2024 20:35:17 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '113', 'Connection': 'keep-alive', 'X-Response-Time': '12ms', 'Access-Control-Allow-Credentials': 'false', 'Referrer-Policy': 'no-referrer', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block')>

2024-06-21 16:35:17.792 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.4.1:443/api/auth/login) b'{"code":"AUTHENTICATION_FAILED_LIMIT_REACHED","message":"You\'ve reached the login attempt limit","level":"debug"}'
2024-06-21 16:35:17.792 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.4.1: Call https://192.168.4.1:443/api/auth/login received 429: b'{"code":"AUTHENTICATION_FAILED_LIMIT_REACHED","message":"You\'ve reached the login attempt limit","level":"debug"}'
2024-06-21 16:35:18.257 ERROR (MainThread) [homeassistant.components.unifiprotect.data] Auth error while updating
Traceback (most recent call last):
  File "/nix/store/sq3by8r3524slnqjm5cj09abg3q455zx-homeassistant-2024.6.3/lib/python3.12/site-packages/homeassistant/components/unifiprotect/data.py", line 133, in async_refresh
    updates = await self.api.update(force=force)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 799, in update
    self._bootstrap = await self.get_bootstrap()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 1127, in get_bootstrap
    data = await self.api_request_obj("bootstrap")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 427, in api_request_obj
    data = await self.api_request(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 406, in api_request
    data = await self.api_request_raw(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 381, in api_request_raw
    raise NotAuthorized(msg % (url, response.status, reason))
uiprotect.exceptions.NotAuthorized: Request failed: /proxy/protect/api/bootstrap - Status: 401 - Reason: {'code': 401, 'message': 'Unauthorized'}

I suspect something happened to my integration and got stuck in a tight auth loop. This manifests in the UI as Failed to connect

Not sure if this is what others are hitting but check your logs. We could consider doing some backoff in the integration if we see a 429.

from core.

corey-klempner avatar corey-klempner commented on June 27, 2024

I'm having this issue. I'm trying to connect using the local IP address of the UDM and port 443. I'm able to log into unifi on a browser using that IP and the local user account I created. I tried deleting and creating a new local user account on Unifi and still I get the same issue.

Logs only show one line: "Error connecting to the UniFi Network at " (my local IP)

from core.

mindstorms6 avatar mindstorms6 commented on June 27, 2024

Can you enable/download the diagnostic logs, restart the integration and post the resulting logs here? (Be sure to remove your password in the logs!)

from core.

corey-klempner avatar corey-klempner commented on June 27, 2024

I can't get the integration to actually enable to the point that I can access the page and download the diagnostic logs. Basically, when I search for Protect and add the integration, it prompts me to enter host, username, password etc. but the submit form fails, and the integration never gets added.

Relevant: I'm using Protect application 4.0.33. I was in Early Access but I changed back to stable. I believe this is the official release

from core.

BlackRockCity avatar BlackRockCity commented on June 27, 2024

I can't get the integration to actually enable to the point that I can access the page and download the diagnostic logs.

Same here!

from core.

Kane610 avatar Kane610 commented on June 27, 2024

I can't get the integration to actually enable to the point that I can access the page and download the diagnostic logs. Basically, when I search for Protect and add the integration, it prompts me to enter host, username, password etc. but the submit form fails, and the integration never gets added.

Relevant: I'm using Protect application 4.0.33. I was in Early Access but I changed back to stable. I believe this is the official release

Please open a separate issue for protect

from core.

Kane610 avatar Kane610 commented on June 27, 2024

I've been hitting the same issue recently - however - it seems like my integration got in a bad state and was hitting the login endpoint on the controller too much. From the integration logs, the controller is now returning a 429 Too Many Requests error:

2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.4.1:443) b'<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="icon" href="/favicon.ico?v3" sizes="any"><link rel="icon" href="/favicon.svg?v3" type="image/svg+xml"><link rel="apple-touch-icon" href="/apple-touch-icon.png?v3"><title>UniFi OS</title><meta name="viewport" content="width=device-width,initial-scale=1"><script>window.UNIFI_OS_MANIFEST = {"model":{"id":"UDW","shortName":"UDW","longName":"UniFi Dream Wall"},"images":{"small":"/assets/images/small.png?udw-2.0.0","medium":"/assets/images/medium.png?udw-2.0.0","large":"/assets/images/large.png?udw-2.0.0","huge":"/assets/images/huge.png?udw-2.0.0"}}</script><script defer="defer" src="/main.1f13cbe8ee4a4f1a0848.js"></script><link href="/main.0e9197a3.css" rel="stylesheet"></head><body><div id="root"></div></body></html>'
2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Talking to UniFi OS device: True
2024-06-21 16:35:17.775 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://192.168.4.1:443/api/auth/login) post, {'username': 'viewonly', 'password': 'OMITTED', 'rememberMe': True}, {}
2024-06-21 16:35:17.792 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://192.168.4.1:443/api/auth/login) 429 application/json <ClientResponse(https://192.168.4.1:443/api/auth/login) [429 Too Many Requests]>
<CIMultiDictProxy('Server': 'nginx', 'Date': 'Fri, 21 Jun 2024 20:35:17 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '113', 'Connection': 'keep-alive', 'X-Response-Time': '12ms', 'Access-Control-Allow-Credentials': 'false', 'Referrer-Policy': 'no-referrer', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block')>

2024-06-21 16:35:17.792 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://192.168.4.1:443/api/auth/login) b'{"code":"AUTHENTICATION_FAILED_LIMIT_REACHED","message":"You\'ve reached the login attempt limit","level":"debug"}'
2024-06-21 16:35:17.792 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.4.1: Call https://192.168.4.1:443/api/auth/login received 429: b'{"code":"AUTHENTICATION_FAILED_LIMIT_REACHED","message":"You\'ve reached the login attempt limit","level":"debug"}'
2024-06-21 16:35:18.257 ERROR (MainThread) [homeassistant.components.unifiprotect.data] Auth error while updating
Traceback (most recent call last):
  File "/nix/store/sq3by8r3524slnqjm5cj09abg3q455zx-homeassistant-2024.6.3/lib/python3.12/site-packages/homeassistant/components/unifiprotect/data.py", line 133, in async_refresh
    updates = await self.api.update(force=force)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 799, in update
    self._bootstrap = await self.get_bootstrap()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 1127, in get_bootstrap
    data = await self.api_request_obj("bootstrap")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 427, in api_request_obj
    data = await self.api_request(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 406, in api_request
    data = await self.api_request_raw(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/v1x8g45h8ywwifv4jq4v5pdzh0svrl2y-python3.12-uiprotect-1.7.2/lib/python3.12/site-packages/uiprotect/api.py", line 381, in api_request_raw
    raise NotAuthorized(msg % (url, response.status, reason))
uiprotect.exceptions.NotAuthorized: Request failed: /proxy/protect/api/bootstrap - Status: 401 - Reason: {'code': 401, 'message': 'Unauthorized'}

I suspect something happened to my integration and got stuck in a tight auth loop. This manifests in the UI as Failed to connect

Not sure if this is what others are hitting but check your logs. We could consider doing some backoff in the integration if we see a 429.

Have you gotten it back to running?

from core.

Blackduke77 avatar Blackduke77 commented on June 27, 2024

I had the same issue, the integration was working, then it wasn't I was complaining abut too many failed authentication attempts, however credentials had not changed, I removed the UDM controller from the integration and tried to re-add it, this failed to get past the add box with failed to connect. I removed the user from the local controller and waited a few hours, then re-added it all back and it worked.

from core.

mindstorms6 avatar mindstorms6 commented on June 27, 2024

For the 429 - yes. Try disabling the integration and restarting the controller. Then re-enable the integration worked for me.

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.