Closed marcjansen89 closed 2 years ago
nest documentation nest source (message by IssueLinks)
Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (nest
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
Hi, do you see any error messages in the home assistant logs?
Hi, do you see any error messages in the home assistant logs?
Hi Allen, thanks for looking into this. This is the only entry that is added to the log around the time the request times out:
Logger: aiohttp.server Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:405 First occurred: 11:16:56 PM (1 occurrences) Last logged: 11:16:56 PM
Error handling request
2022-01-04 23:16:56 ERROR (MainThread) [aiohttp.server] Error handling request
Thanks, appreciate all the detail in the report.
Are there any other details in the full log available?
Would you also be able to add this to your configuration.yaml
to turn on debug logging in a few different components?
logger:
default: info
logs:
homeassistant.util.package: debug
homeassistant.components.nest: debug
homeassistant.helpers.config_entry_flow: debug
homeassistant.helpers.config_entry_oauth2_flow: debug
google_nest_sdm: debug
google_nest_sdm.auth: debug
Since we're not getting anything useful from the logs, this may help us track down what is happening when things start to go wrong. It doesn't seem like its specific to the Nest API, so not sure where else the problem might be.
That was all there was in the logs. I have added the debugs to the configurarion.yaml and now I see this one as addition. My guess is this ons is from the start of the request:
Logger: py.warnings Source: /usr/local/lib/python3.9/warnings.py:109 First occurred: 11:41:07 PM (1 occurrences) Last logged: 11:41:07 PM
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.2.158'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(
And the next one is the one we saw already which occurs at timeout:
Logger: aiohttp.server Source: /usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py:405 First occurred: 11:46:11 PM (1 occurrences) Last logged: 11:46:11 PM
Error handling request
Can you also double check the "full" log? My impression is it prints messages (info, warning, error, debug) on single line.
Currently on my phone, don't know if that matters?
The unverified https call message seems to be unrelated. I have ran the setup again and this time it only shows the following two entries in the full log:
2022-01-05 00:24:19 ERROR (MainThread) [aiohttp.server] Error handling request 2022-01-05 00:26:00 ERROR (MainThread) [aiohttp.server] Error handling request
Alas, no further details are given.
OK thanks. Make sure you restart home assistant to pick up the configuration changes, then try again? I'm guessing the restart did not happen yet basted on the timestamps in the logs -- sorry forgot to mention that.
If this doesn't produce anything, then I don't have any great ideas.
I'm positive i restarted home assistant via the server control page. The log also shows more info than before, just not when the error occured.
Perhaps another bit of important info: i'm running home assistant via Virtualbox on a Windows host. Might that somehow mess up networking? Is it possible Windows firewall on the host device is in the way? I can't check it out right now as my partner is demanding me to go sleep, but I will verify that later just to be sure.
Hi, I don't think we understand the problem yet. Have any debug logs as described above? Also seeing general network issues?
I added an addition logger to the list that would be helpful to give more information about what is going on:
logger:
default: info
logs:
homeassistant.util.package: debug
homeassistant.components.nest: debug
homeassistant.components.http.view: debug
homeassistant.helpers.config_entry_flow: debug
homeassistant.helpers.config_entry_oauth2_flow: debug
google_nest_sdm: debug
google_nest_sdm.auth: debug
Same issue! Running HA on RPi4.
Logger: aiohttp.server Source: helpers/config_entry_oauth2_flow.py:201 First occurred: 2:47:56 PM (4 occurrences) Last logged: 2:58:45 PM
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/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 92, 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 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 181, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, 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 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/nest/config_flow.py", line 224, in async_step_auth return await super().async_step_creation(user_input) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 293, in async_step_creation token = await self.flow_impl.async_resolve_external_data(self.external_data) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 165, in async_resolve_external_data return await self._token_request( File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 201, in _token_request resp.raise_for_status() File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://www.googleapis.com/oauth2/v4/token')
Thanks, have any details in your logs?
Just updated my previous comment.
Thanks, that is very helpful. Do you have the debug logs also though? There should be a line from. homeassistant.helpers.config_entry_oauth2_flow
with important details to help debug from here
Is this what you're looking for:
2022-01-11 11:13:10 DEBUG (MainThread) [homeassistant.helpers.config_entry_oauth2_flow] Token request failed with status=401, body={ "error": "invalid_client", "error_description": "Unauthorized" }
Yes! Exactly.
I am pretty sure this means the client id is incorrect.
Hmm - ok, thanks for your help. I'll verify on my end and update if the issue is resolved for me.
@MarcHKV it is not clear if your issue is the same issue or not, but maybe you can check logs from desktop and verify your logging setup in configuration.yaml is setup as I mentioned before. There are a couple funny things about the log output where its not including the full stack trace like I would expect so I am a little puzzled, so maybe its a desktop vs mobile thing.
I am having the exact same issue as @MarcHKV . Added the logger settings as mentioned above but no extra output is logged. Restarted the home assistant service as well as the machine itself but without any change.
2022-01-16 12:27:51 ERROR (MainThread) [aiohttp.server] Error handling request
Not sure if I need to create a seperate issue but this is my home assistant installation:
version | core-2021.12.9 |
---|---|
installation_type | Home Assistant OS |
dev | false |
hassio | true |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.7 |
os_name | Linux |
os_version | 5.10.88 |
arch | x86_64 |
timezone | Europe/Brussels |
I too was seeing this exact problem (can't connect, no useful error reports, etc.), but I have fixed it; turns out the issue isn't HA. My fix was to turn off IPv6 on my router. Make sure you can manually ping google on the same machine on which HA is installed.
Running in a Docker container on Raspberry Pi 4, HA version 2021.12.9.
I have my router set up to use IPv6 for the LAN even though my ISP (Verizon Fios) doesn't support IPv6. As a result, when I try to ping google my pi tries to use the IPv6 address and it doesn't work. Forcing it to use IPv4 works.
$ ping google.com
PING google.com(lga25s73-in-x0e.1e100.net (2607:f8b0:4006:816::200e)) 56 data bytes
^C
--- google.com ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 162ms
$ ping google.com -4
PING google.com (142.250.65.238) 56(84) bytes of data.
64 bytes from lga25s73-in-f14.1e100.net (142.250.65.238): icmp_seq=1 ttl=118 time=11.2 ms
64 bytes from lga25s73-in-f14.1e100.net (142.250.65.238): icmp_seq=2 ttl=118 time=12.0 ms
64 bytes from lga25s73-in-f14.1e100.net (142.250.65.238): icmp_seq=3 ttl=118 time=9.89 ms
I turned off IPv6 on my router and now I'm able to add my Nest device. As an added bonus, on the /config/info
page it now says I can reach the Home Assistant Cloud server (previously it wasn't connecting there either).
Is there any way to add helpful error messages to prevent this problem coming up in the future?
Yeah, that's a really bad failure mode for a network problem!
I recently was able to upgrade cloud pubsub and grpc for the next home assistant release and I would love to see if that helps with the failure modes. If someone reproducing this was feeling brave enough to try on a dev/nightly build that would be cool.
Otherwise, may need to figure out steps to reproduce this...
OMG Thanks @bikeshop45 ! That was it indeed. Disabled IPv6 on my host machine network card and everything works now.
@allenporter I'm happy to test any fixes. I did try a fresh install of the dev branch (basically used the container installation instructions and replaced stable
with dev
). Version info below. Unfortunately wasn't able to test the original bug because as soon as I copied over the same nest
YAML configuration from my working example to configuration.yaml
and restarted the server, it gives the following error, i.e., this happens before I can even try to add the Nest integration. There is no error when I remove that part of the config:
2022-01-17 09:15:53 ERROR (MainThread) [homeassistant.setup] Setup failed for nest: Unable to import component: Error relocating /usr/local/lib/python3.9/site-packages/grpc/_cython/cygrpc.cpython-39-arm-linux-gnueabihf.so: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEv: symbol not found
version | core-2022.2.0.dev20220116 |
---|---|
installation_type | Home Assistant Container |
dev | true |
hassio | false |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.7 |
os_name | Linux |
os_version | 5.10.63-v7l+ |
arch | armv7l |
timezone | UTC |
Damn, I spent months attempting to resolve ethat. Can you delete that all that form this issue and discuss in https://github.com/home-assistant/core/issues/56669 ?
Will continue that separate discussion. I tried adding a Nest device using 2022.2.0.dev20220112
which doesn't have the import error and this original "unknown error" message still appears and there's still no additional notes in the log. Sounds like we should return to this once #56669 is fixed.
Just for context #56669 only applies if you are on armv7 so I wouldn't say that is true in general.
I am curious if folks still see this running the home assistant beta?
I wasn't able to recreate the same conditions as when I originally saw this error; for some reason even with IPv6 enabled on my router, ping
defaults to an IPv4 address and all is right with the world. Tried to simulate the effect by disconnecting my internet connection while keeping my LAN connected, did this in both the most recent container dev version (2022.3.0.dev20220130) and the current stable version (core-2021.12.10).
In both cases, it still times out with an "Unknown Error" as in the original screenshot. The good news is that it fails within a few seconds (before it would take ~minutes to time out), but still shows the unhelpful "unknown error" message.
With the caveat that this may not be the original issue exactly, I attach the relevant portion of the log, which does show a ClientConnectorError
.
version | core-2022.3.0.dev20220130 |
---|---|
installation_type | Home Assistant Container |
dev | true |
hassio | false |
docker | true |
user | root |
virtualenv | false |
python_version | 3.9.7 |
os_name | Linux |
os_version | 5.10.63-v7l+ |
arch | armv7l |
timezone | UTC |
getaddrinfo
there implies that maybe this is a DNS issue? as it can't look up www.google.com
. I'm not sure what the nest integration can do about this, or whats triggering it. e.g. https://community.home-assistant.io/t/mayor-problems-api-github-com/209366
Hi, anyone else who was hitting this have anything else to report about this issue with the latest version of home assistant?
I also ran into this issue with IPv6, for anyone that finds it.
@benyafai what version of home assistant? I'm trying to understand if recent cloud pubsub subscriber library updates helped with this.
Sure... core-2022.2.6 supervisor-2022.01.1 Home Assistant OS 7.4
Thanks, so the issue still is present. I think the next step to solve the root cause is to get more details about here the problem is, since we have no error messages. Maybe someone hitting this is (before disabling ipv6) is willing to turn up more debug logging to capture more details. I don't have an ipv6 setup, so haven't tried to reproduce this yet myself.
I am having this issue. Running core-2022.2.6 in docker and I haven't disable ipv6, but am able to ping 'google.com' from my HA container.
below is my log dump.
`Logger: aiohttp.server Source: helpers/config_entry_oauth2_flow.py:201 First occurred: 2:49:55 PM (1 occurrences) Last logged: 2:49:55 PM
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/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 220, 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 219, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 164, 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 111, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 252, in async_configure result = await self._async_handle_step(flow, cur_step["step_id"], user_input) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 325, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/usr/src/homeassistant/homeassistant/components/nest/config_flow.py", line 277, in async_step_auth return await super().async_step_creation(user_input) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 293, in async_step_creation token = await self.flow_impl.async_resolve_external_data(self.external_data) File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 165, in async_resolve_external_data return await self._token_request( File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 201, in _token_request resp.raise_for_status() File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 401, message='Unauthorized', url=URL('https://www.googleapis.com/oauth2/v4/token') `
@flamingotter I think your issue is different and that the client id is likely incorrect -- see the discussion above https://github.com/home-assistant/core/issues/63410#issuecomment-1010292646 including the extra logging above to get a detailed error message
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.
The problem
I am trying to add a nest intergration to Home Assistant by following this guide: https://www.home-assistant.io/integrations/nest
I have followed the guide word by word and got to the Device Setup > OAuth and Device Authorization steps Here I have to add the nest integration and authorize my google account. I accept my Oauth screen, and enter the access code that is provided by the Oauth. Then the screen will just keep on loading and eventually stop with the error: "unknown error occured":
I have tried to guide multiple times to make sure I didn't mess up. I also have verified if my nest account is a google account (it is) and I don't have any weird constructions with multiple homes (I used to but removed them as I read that sometimes that messes things up)
I am able to follow: https://developers.google.com/nest/device-access/authorize#modify_account_permissions which used a web server call, but the API works which means my SDM API is working.
Following that guide also resulted in my GCP to have a partner connection with nest (which is a good thing, I think?) which I can view from: https://nestservices.google.com/partnerconnections
What version of Home Assistant Core has the issue?
core-2021.12.7
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
nest
Link to integration documentation on our website
https://www.home-assistant.io/integrations/nest
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
The authentication call being made that keeps pending and fails is: http://homeassistant.local:8123/api/config/config_entries/flow/b44c184ddc35495db35063e28c2cf180
It has a payload of: {"code":"4/(omitted access token)"}
In the console (Google Chrome) it gives the error: Failed to load resource: the server responded with a status of 504 (Gateway Timeout) POST http://homeassistant.local:8123/api/config/config_entries/flow/b44c184ddc35495db35063e28c2cf180 504 (Gateway Timeout)