home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.9k stars 30.12k forks source link

Unifi Network will not connect - 404 Not Found message #74547

Closed bluestar888 closed 2 years ago

bluestar888 commented 2 years ago

The problem

I updated to 2022.7.0 and the integration will not connect anymore. Deleted integration , restarted HA , added ,same. Receiving Unknown error and sometimes both unknow and cannot connect. I am using a local user only. Last version to work 2022.6.4 Unifi Protect Integration works fine.

UniFi OS UDM Pro 1.12.22 Network 7.1.66

Please see logs.

What version of Home Assistant Core has the issue?

2022.7.0

What was the last working version of Home Assistant Core?

2022.6.4

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Unifi Network

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?

Logger: aiohttp.server
Source: components/unifi/config_flow.py:112
First occurred: 3:40:54 PM (6 occurrences)
Last logged: 4:00:18 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure
    result = await self._async_handle_step(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/unifi/config_flow.py", line 112, in async_step_user
    sites = await controller.sites()
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 148, in sites
    sites = await self.request("get", url=url)
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 287, in request
    return await self._request(method, url, json)
  File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 326, in _request
    raise ResponseError(f"Call {url} received 404 Not Found")
aiounifi.errors.ResponseError: Call https://192.168.0.1:443/proxy/network/api/self/sites received 404 Not Found

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

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! (message by CodeOwnersMention)


unifi documentation unifi source (message by IssueLinks)

entropie commented 2 years ago

I checked before updating to 2022.7 if the problem still persists.

Looks like: https://github.com/home-assistant/core/issues/73965

2022.6.4 is the last working version with unifi network working

ziptbm commented 2 years ago

Are you using a UI or local account to connect to UniFi?

I had a similar issue after upgrading HA and had to change both UniFi Network and UniFi Protect to use the local login account. Not sure if related, but mentioning in case it's helpful.

BallistikG commented 2 years ago

I have the same issue

tigger1972 commented 2 years ago

Same issue here!

misterduve commented 2 years ago

Same issue.

Kane610 commented 2 years ago

A 404 typically means some issue on UniFi side. Have you tried restarting your UniFi equipment?

Running

UniFi OS UDM Pro 1.12.22
Network 7.1.66

And it works perfectly fine for me, so Im missing some information to reproduce it.

Issue seems as the same as is reported here https://github.com/home-assistant/core/issues/73245

Can you enable debugging for the integration and share those logs?

JoshuaRedmond commented 2 years ago

I've raised #74602 which looks like the same issue but has a 401 in the logs instead of a 404. Apologies if it should have been kept together, but the different error message suggests it's a different failure mode.

mgcnt commented 2 years ago

same issue here, UDM Pro release: 1.12.22

Updated HA to 2022.07 Restarted HA same issue:

Logger: homeassistant.config_entries Source: components/unifi/controller.py:311 First occurred: 13:50:07 (1 occurrences) Last logged: 13:50:07

Error setting up entry Default for unifi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 353, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/unifi/init.py", line 41, in async_setup_entry if not await controller.async_setup(): File "/usr/src/homeassistant/homeassistant/components/unifi/controller.py", line 311, in async_setup await self.api.initialize() File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 160, in initialize await self.clients.update() File "/usr/local/lib/python3.10/site-packages/aiounifi/interfaces/api.py", line 35, in update raw = await self.controller.request("get", self.path) File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 287, in request return await self._request(method, url, json) File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 326, in _request raise ResponseError(f"Call {url} received 404 Not Found") aiounifi.errors.ResponseError: Call https://:443/proxy/network/api/s/default/stat/sta received 404 Not Found

louispires commented 2 years ago

I have not yet upgrade to 2022.07 yet

However I am running 2022.6.7 where it is still working. Simply replying as the OP states:

What was the last working version of Home Assistant Core? 2022.6.4

UDM Pro: 1.12.22 Network: 7.1.67

mjoshd commented 2 years ago

For what it's worth, the unifi integration stopped working here too when I upgraded to 2022.7.0

image

After the update nothing related to the unifi integration was working.

Tried rebooting both the UDM Pro & Home Assistant but the issue persisted.

I rolled back to 2022.6.7 and everything unifi-related started working again: ha core update --version 2022.6.7

BallistikG commented 2 years ago

I just rolled back to 2012.6.7 and get the exact same issue

Kane610 commented 2 years ago

What is needed right now are debug logs in 2022.7 with unifi os and controller upgraded to latest stable

bluestar888 commented 2 years ago

I have all latest.

Which is the component for unifi network ?

Would it be something like

homeassistant.components.unifi_network: debug

This is my current logger setup in configuration.yaml

logger:

The next line sets the default logging level, for all python modules.

It seems "recommended" to set it to avoid too much logging.

default: warning

logs:

custom_components.zha_toolkit: debug

homeassistant.components.govee: debug

custom_components.govee: debug

govee_api_laggat: debug

Cheers

From: Robert Svensson @.> Sent: July 7, 2022 2:19 PM To: home-assistant/core @.> Cc: bluestar888 @.>; Author @.> Subject: Re: [home-assistant/core] Unifi Network will not connect (Issue #74547)

What is needed right now are debug logs in 2022.7 with unifi os and controller upgraded to latest stable

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74547#issuecomment-1178243203 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEH4R5XBKSSMD2664CEJL3VS5CVJANCNFSM523NIZGA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AWEH4RYKP2SQWESXD4BYN7LVS5CVJA5CNFSM523NIZGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIY5JBAY.gif Message ID: @. @.> >

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

bluestar888 commented 2 years ago

Yup ,6.4 is the latest working version.

From: BallistikG @.> Sent: July 7, 2022 2:14 PM To: home-assistant/core @.> Cc: bluestar888 @.>; Author @.> Subject: Re: [home-assistant/core] Unifi Network will not connect (Issue #74547)

I just rolled back to 2012.6.7 and get the exact same issue

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74547#issuecomment-1178238130 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEH4R2VOHV4MSQODHX3UO3VS5B7ZANCNFSM523NIZGA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AWEH4R7E6XKNFDPMAEOSHOTVS5B7ZA5CNFSM523NIZGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIY5HZMQ.gif Message ID: @. @.> >

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

COCottonwood commented 2 years ago

Could this be related to PR# https://github.com/home-assistant/core/issues/74551 - "Python 3.10 ssl cipher defaults in HA 2022.7.0 break the Elk M1 integration"?

mjoshd commented 2 years ago

I had an opportunity to try and get some logs this morning so I added the logger info from the unifi integration page and ran the upgrade to 2022.7 again.

Apparently there has been an update as I got 2022.7.1 this time instead of 2022.7.0.

Perhaps something in the x.x.1 release cleared up the issue, not really sure, but everything unifi-related is working fine on 2022.7.1 and this time there are no unifi errors in the logs.

Kane610 commented 2 years ago

Could this be related to PR# #74551 - "Python 3.10 ssl cipher defaults in HA 2022.7.0 break the Elk M1 integration"?

Its a good suggestion, but I don't think so, unless you see ssl cipher issues

mgcnt commented 2 years ago

I had an opportunity to try and get some logs this morning so I added the logger info from the unifi integration page and ran the upgrade to 2022.7 again.

Apparently there has been an update as I got 2022.7.1 this time instead of 2022.7.0.

Perhaps something in the x.x.1 release cleared up the issue, not really sure, but everything unifi-related is working fine on 2022.7.1 and this time there are no unifi errors in the logs.

Just upgraded also to 2022.7.1 Too bad still broken. Also got the warning HA couldn't migrate the entities

Kane610 commented 2 years ago

I have all latest. Which is the component for unifi network ? Would it be something like homeassistant.components.unifi_network: debug

https://www.home-assistant.io/integrations/unifi#debugging-integration

mgcnt commented 2 years ago

I have all latest. Which is the component for unifi network ? Would it be something like homeassistant.components.unifi_network: debug

https://www.home-assistant.io/integrations/unifi#debugging-integration

Just removed the intergration and tried to re-add it again. Now getting the error - Unknown error occurred This happens at the connection screen.

Using a local user to connect

So also can't debug it anymore :( sorry

bluestar888 commented 2 years ago

I added the debug lines to the configurational .upgraded to 7.1 , restart but I am still not getting any more details logs than before.

please see attached.

Error is still unknown error with a 404 not found

I there anywhere else I need to go to get more detailed logs ?

From: Robert Svensson @.> Sent: July 7, 2022 2:19 PM To: home-assistant/core @.> Cc: bluestar888 @.>; Author @.> Subject: Re: [home-assistant/core] Unifi Network will not connect (Issue #74547)

What is needed right now are debug logs in 2022.7 with unifi os and controller upgraded to latest stable

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74547#issuecomment-1178243203 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEH4R5XBKSSMD2664CEJL3VS5CVJANCNFSM523NIZGA . You are receiving this because you authored the thread.Message ID: @.***>

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Logger: aiohttp.server Source: components/unifi/config_flow.py:112 First occurred: 11:01:02 AM (1 occurrences) Last logged: 11:01:02 AM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper result = await method(view, request, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/unifi/config_flow.py", line 112, in async_step_user sites = await controller.sites() File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 148, in sites sites = await self.request("get", url=url) File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 287, in request return await self._request(method, url, json) File "/usr/local/lib/python3.10/site-packages/aiounifi/controller.py", line 326, in _request raise ResponseError(f"Call {url} received 404 Not Found") aiounifi.errors.ResponseError: Call https://192.168.0.1:443/proxy/network/api/self/sites received 404 Not Found

==========================

bluestar888 commented 2 years ago

After I unplugged the UDM -Pro while running and plugged it back in the integration now works.

Multiple previous console restarts did nothing.

Obviously a backup is recommended before going down that path.

The network was working just fine so likely an issue with the actual network application on the Unifi console.

From: @. @.> Sent: July 8, 2022 11:08 AM To: 'home-assistant/core' @.>; 'home-assistant/core' @.> Cc: 'Author' @.***> Subject: RE: [home-assistant/core] Unifi Network will not connect (Issue #74547)

I added the debug lines to the configurational .upgraded to 7.1 , restart but I am still not getting any more details logs than before.

please see attached.

Error is still unknown error with a 404 not found

I there anywhere else I need to go to get more detailed logs ?

From: Robert Svensson @. @.> > Sent: July 7, 2022 2:19 PM To: home-assistant/core @. @.> > Cc: bluestar888 @. @.> >; Author @. @.> > Subject: Re: [home-assistant/core] Unifi Network will not connect (Issue #74547)

What is needed right now are debug logs in 2022.7 with unifi os and controller upgraded to latest stable

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/74547#issuecomment-1178243203 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEH4R5XBKSSMD2664CEJL3VS5CVJANCNFSM523NIZGA . You are receiving this because you authored the thread.Message ID: @. @.> >

-- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Kane610 commented 2 years ago

After I unplugged the UDM -Pro while running and plugged it back in the integration now works. Multiple previous console restarts did nothing.

Good that it works for you, bad that the only solution is to restart the system :/

tigger1972 commented 2 years ago

Same issue here!

Reboot solve also my issue!

woodmj74 commented 2 years ago

I don't know if this helps:

In my production instance 2022.6.6 the integration is working; the exact same HA configuration for this integration pointing at the same cloudkey on my dev instance running 2022.7.2 generates these logs:

2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] https://192.168.0.10:443
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.0.10:443) [200 OK]>
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] https://192.168.0.10:443/api/auth/login
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.0.10:443/api/auth/login) [404 Not Found]>
2022-07-09 12:32:27 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.0.10: Call https://192.168.0.10:443/api/auth/login received 404 Not Found
Kane610 commented 2 years ago

I don't know if this helps:

In my production instance 2022.6.6 the integration is working; the exact same HA configuration for this integration pointing at the same cloudkey on my dev instance running 2022.7.2 generates these logs:

2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] https://192.168.0.10:443
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.0.10:443) [200 OK]>
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] https://192.168.0.10:443/api/auth/login
2022-07-09 12:32:27 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.0.10:443/api/auth/login) [404 Not Found]>
2022-07-09 12:32:27 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.0.10: Call https://192.168.0.10:443/api/auth/login received 404 Not Found

I need full debug logs don't filter out the response data

woodmj74 commented 2 years ago

I can't explain anything, but it seems to be running again for me now. A number of reboots, tinkering and unexplained magic has got stuff going again. Successfully upgraded my production instance without issue. Appreciate the support @Kane610

Kane610 commented 2 years ago

I can't explain anything, but it seems to be running again for me now. A number of reboots, tinkering and unexplained magic has got stuff going again. Successfully upgraded my production instance without issue. Appreciate the support @Kane610

This is the issue with reverse engineering APIs

maxwdjoh commented 2 years ago

Is doing the hard power down likely to be the only way to get the integration to work on the updated version of HA? Or is there a chance for it to be fixed in a newer revision? Don't mind doing the hard power down but am hesitant as if that is the only fix going forward.

Kane610 commented 2 years ago

Is doing the hard power down likely to be the only way to get the integration to work on the updated version of HA? Or is there a chance for it to be fixed in a newer revision? Don't mind doing the hard power down but am hesitant as if that is the only fix going forward.

There are no leads on how to solve this in the code ATM, the only solution people have brought up so far is to restart their UniFi system.

entropie commented 2 years ago

TL;DR: step by step troubleshooting failed, updating Unifi OS Version to 2.4.10 (latest stable) solved everything (after all the steps here)

HA docker, 2022.7.3 Unifi OS Version: 2.2.12 Network Version: 7.1.66 Protect Version: 2.0.1

Trying to provide debug infos. Log after update to ha, not touching intergration (worked before)

2022-07-11 00:05:27 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': 'a27ef309-6030-4261-b03b-3d90f83fd652', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '8ms', 'Set-Cookie': 'TOKEN=redacted; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:05:27 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:05:27 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:05:27 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '101ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:05:27 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:05:27 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.2: Call https://192.168.1.2:443/api/auth/login received 404 Not Found
2022-07-11 00:05:27 WARNING (MainThread) [homeassistant.config_entries] Config entry 'TrompiE' for unifi integration not ready yet; Retrying in background

2022-07-11 00:06:00 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': '4c632e2f-247f-4747-aaf8-f19c8826f523', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '17ms', 'Set-Cookie': 'TOKEN=redacred; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:06:00 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:06:00 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:06:01 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '5ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:06:01 GMT', 'Connection': 'keep-alive')>

Removing the integration, and reinstalling and setting up

2022-07-11 00:19:49 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443
2022-07-11 00:19:49 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': '77d37dfc-6a35-4098-aca7-003783256395', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '4ms', 'Set-Cookie': 'TOKEN=redacted; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:19:49 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:19:49 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:19:49 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '11ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:19:49 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:19:49 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.2: Call https://192.168.1.2:443/api/auth/login received 404 Not Found

Soft reboot of cloudkey (from web interface), trying to setup integration

2022-07-11 00:30:07 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443
2022-07-11 00:30:07 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': 'ccea4eae-8ca7-4404-ba85-8085748fd6c5', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '8ms', 'Set-Cookie': 'TOKEN=redacted; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:30:07 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:30:07 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:30:07 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '11ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:30:07 GMT', 'Connection': 'keep-

This were the steps I tried before. Now i'll powerdown cloudkey and restart. No difference (I think)

2022-07-11 00:35:32 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443
2022-07-11 00:35:32 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': '7415c40f-0a11-47d4-8e39-9f6b41f17746', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '12ms', 'Set-Cookie': 'TOKEN=redacted; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:35:32 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:35:32 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:35:32 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '7ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:35:32 GMT', 'Connection': 'keep-alive')>

After Hard reboot (I struggled to pull the cable, but I managed it)

2022-07-11 00:47:28 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443
2022-07-11 00:47:29 DEBUG (MainThread) [aiounifi.controller] 200 text/html <ClientResponse(https://192.168.1.2:443) [200 OK]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-CSRF-Token': '7321a24e-ce73-40a1-b078-9647e195f88c', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '447', 'X-Response-Time': '11ms', 'Set-Cookie': 'TOKEN=redacted; path=/; samesite=strict; secure; httponly', 'Date': 'Sun, 10 Jul 2022 22:47:29 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:47:29 DEBUG (MainThread) [aiounifi.controller] https://192.168.1.2:443/api/auth/login
2022-07-11 00:47:29 DEBUG (MainThread) [aiounifi.controller] 404 text/plain <ClientResponse(https://192.168.1.2:443/api/auth/login) [404 Not Found]>
<CIMultiDictProxy('Vary': 'Origin', 'X-DNS-Prefetch-Control': 'off', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block', 'Accept-Ranges': 'bytes', 'X-Response-Time': '15ms', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '9', 'Date': 'Sun, 10 Jul 2022 22:47:29 GMT', 'Connection': 'keep-alive')>

2022-07-11 00:47:29 ERROR (MainThread) [homeassistant.components.unifi] Error connecting to the UniFi Network at 192.168.1.2: Call https://192.168.1.2:443/api/auth/login received 404 Not Found                                  
vandalon commented 2 years ago

Running Unifi OS 2.4.10 with protect 2.0.1 on CK+ here and I'm seeing the 401 issue at least once a day since HA 2202.07 up to 2202.07.02

mgcnt commented 2 years ago

Hard power down (remove powercable) from the UDM Pro did solve the issue. Very strange.

Now running 2022.7.2 without problems with the unify intergration

ryan408 commented 2 years ago

I have the same issue with a CloudKey Gen 2. Hasn't worked since updating to 2022.7.0. I have tried rebooting the CK a few times but still get the 404 error when attempting to reinstall the Unifi Network integration.

Logger: homeassistant.components.unifi Source: components/unifi/controller.py:513 Integration: UniFi Network (documentation, issues) First occurred: 12:08:46 PM (1 occurrences) Last logged: 12:08:46 PM

Error connecting to the UniFi Network at 192.168.1.81: Call https://192.168.1.81:443/api/auth/login received 404 Not Found

kennybitte commented 2 years ago

I'm getting a slightly different error with the UniFi Network Application 7.1.66 Just, "Failed to connect" image

I did a Tcpdump on the UniFi Network App server and there we no connection attempts made from HA.

Logger: homeassistant.components.unifi Source: components/unifi/controller.py:513 Integration: UniFi Network (documentation, issues) First occurred: 2:59:35 PM (9 occurrences) Last logged: 3:28:23 PM

Error connecting to the UniFi Network at ub.home.liquidkinetics.com: Error requesting data from ub.home.liquidkinetics.com: Cannot connect to host ub.home.liquidkinetics.com:443 ssl:default [Connect call failed ('192.168.3.215', 443)] Error connecting to the UniFi Network at 192.168.3.215: Error requesting data from 192.168.3.215: Cannot connect to host 192.168.3.215:443 ssl:default [Connect call failed ('192.168.3.215', 443)] Error connecting to the UniFi Network at https://192.168.3.215: Error requesting data from https://192.168.3.215: Cannot connect to host https:443 ssl:default [Name does not resolve] Error connecting to the UniFi Network at ha.home.liquidkinetics.com: Error requesting data from ha.home.liquidkinetics.com: Cannot connect to host ha.home.liquidkinetics.com:443 ssl:default [Connect call failed ('192.168.3.154', 443)]

Kane610 commented 2 years ago

I'm getting a slightly different error with the UniFi Network Application 7.1.66 Just, "Failed to connect" image

I did a Tcpdump on the UniFi Network App server and there we no connection attempts made from HA.

Logger: homeassistant.components.unifi Source: components/unifi/controller.py:513 Integration: UniFi Network (documentation, issues) First occurred: 2:59:35 PM (9 occurrences) Last logged: 3:28:23 PM

Error connecting to the UniFi Network at ub.home.liquidkinetics.com: Error requesting data from ub.home.liquidkinetics.com: Cannot connect to host ub.home.liquidkinetics.com:443 ssl:default [Connect call failed ('192.168.3.215', 443)] Error connecting to the UniFi Network at 192.168.3.215: Error requesting data from 192.168.3.215: Cannot connect to host 192.168.3.215:443 ssl:default [Connect call failed ('192.168.3.215', 443)] Error connecting to the UniFi Network at https://192.168.3.215: Error requesting data from https://192.168.3.215: Cannot connect to host https:443 ssl:default [Name does not resolve] Error connecting to the UniFi Network at ha.home.liquidkinetics.com: Error requesting data from ha.home.liquidkinetics.com: Cannot connect to host ha.home.liquidkinetics.com:443 ssl:default [Connect call failed ('192.168.3.154', 443)]

Different error means different issue, please create a new issue.

Kane610 commented 2 years ago

I have the same issue with a CloudKey Gen 2. Hasn't worked since updating to 2022.7.0. I have tried rebooting the CK a few times but still get the 404 error when attempting to reinstall the Unifi Network integration.

Logger: homeassistant.components.unifi Source: components/unifi/controller.py:513 Integration: UniFi Network (documentation, issues) First occurred: 12:08:46 PM (1 occurrences) Last logged: 12:08:46 PM

Error connecting to the UniFi Network at 192.168.1.81: Call https://192.168.1.81:443/api/auth/login received 404 Not Found

Make sure you update your equipment to latest stable.

Kane610 commented 2 years ago

Running Unifi OS 2.4.10 with protect 2.0.1 on CK+ here and I'm seeing the 401 issue at least once a day since HA 2202.07 up to 2202.07.02

This issue is about 404 error, 401 errors are supposedly solved, if you still get it create a new issue with all details needed.

bluestar888 commented 2 years ago

Hard Power cycle the UDM-Pro (Unplug the power cable) seems to fix the issue in majority of the cases. Console reboots or soft shutdowns do not. We will monitor at future upgrades .