Hi, can you file an issue in github? That may help get more eyes on it, including the folks doing the releases. Nest code hasn’t changed here, so we’ll want to have a broader look, (e.g. did a frontend template change?)
Sure but this is only happening on this integration… I have two zigbee multisensors in two different areas reporting two different temperatures and neither are doing this, only the temp coming from the Nest thermostat.
Right. Nest definitely uses many decimal places under the covers, returned from the api and present when converting from C to F, so I’m not surprised.
But still saying the code hasn’t changed and I expect home assistant to handle this. Thanks, the bug landed on me.
This integration had been working fine for me but recently prompted again to re-authenticate and is no longer completing the authentication process. At this point I’ve tried completely removing the configs from configuration.yaml, restarting and re-adding, as well as other troubleshooting steps from this thread as well as re-building everything on the google side. Current symptoms are as follows:
Boot up takes a long time for the nest component to time out, with log messages such as: 2021-04-09 11:51:43 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: nest
When my system is finally ready, I get the notice in my integrations, the nest integration says ‘attention required’ and I can click to reconfigure. This brings up the prompt that the nest integration needs to re-authenticate. This opens a new window, I can go through the prompts to grant access as expected, and after clicking the last ‘allow’ the window closes, however in the HA UI, the ‘open website’ prompt stays on my screen. If I click ‘open website’ again, I get the same prompts, however the last ‘allow’ window stays open and eventually times out with a ‘504 gateway timeout’ error (I’m using nginx to proxy SSL traffic).
What appears to be happening is that the nest integration is not properly listening for the auth callback (the page that times out with the 504 message is in the format https://[my-ha-server]/auth/external/callback?state=[google auth info]
The proxy/external connections seem to be set up correctly as going directly to https://[my-ha-server]/auth/external/callback returns “Missing code or state parameter in http://[my-ha-server]/auth/external/callback” which suggests that the proxies and external access are working correctly. Also my google assistant integration is working correctly with these proxy configs.
I’ve found posts about similar issues with other modules and usually the solution was to uninstall and reinstall the module, however since the nest module is built-in to HA, there doesn’t seem to be any way to do that, and just removing the configs from my yaml file and rebooting do not seem to help. I’ve tried enabling logs per [https://www.home-assistant.io/integrations/nest/#troubleshooting ], however no new log entries show up during this process.
Hi @tsaro, maybe there are some additional oauth callback related debug logs that you can enable to see what is happening. Another option could be to peer into the .storage/*. config_entries files and see if there is anything left over there from a previous install that could be causing a problem. Thanks for the detailed report, though this is tough. We could also take this to a github issue if you’d like to debug in more detail.
I’d be happy to help debug more thoroughly, not seeing any callback related logs which are frustrating but maybe thats another component I need to enable debug logging for?
I think a lot of the interesting code for oauth callbacks are:
homeassistant.helpers.config_entry_oauth2_flow
homeassistant.helpers.config_entry_flow
So maybe turning up logging for those components will help. Any luck removing any old config entries?
Thanks, I’ll try turning those on. I did find one old device entry but removing didn’t seem to make any difference.
Not much luck there, not seeing anything from those new log lines but I did find a couple entries when I turned on debug for all logs, I can see the callback URL getting called but nothing coming from the entry_flow or oauth2_flow helper log settings.
2021-04-10 13:13:12 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated x.x.x.145 for /api/config/config_entries/flow_handlers using bearer token
2021-04-10 13:13:12 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow_handlers to x.x.x.145 (auth: True)
2021-04-10 13:13:14 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated x.x.x.145 for /api/config/config_entries/flow using bearer token
2021-04-10 13:13:14 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow to x.x.x.145 (auth: True)
2021-04-10 13:13:35 DEBUG (MainThread) [homeassistant.components.http.view] Serving /auth/external/callback to x.x.x.145 (auth: False)
2021-04-10 13:13:35 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated x.x.x.145 for /api/config/config_entries/flow/64b14cc266ce4366b110934d0e6753a7 using bearer token
2021-04-10 13:13:35 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow/64b14cc266ce4366b110934d0e6753a7 to x.x.x.145 (auth: True)
@tsaro I notice the log doesn’t see a request that includes /auth/external/callback
. You mentioned before that since you’re able to go to the URL and get back a response from home assistant that it indicated that your proxy is working, but I wonder if lack of a Serving
line for that call implies it might not be, at least for posts? Does your proxy have any more details about the failed response from home assistant or can you confirm that you see a request and body being sent that is timing out? We’re kind of out of my area of expertise here, since we don’t see anything going wrong nest specific, but if you have reason to see a problem with nest code let me know. Otherwise, i’d suggest adding more logging in the home assistant code.
There is a line in the above referencing the callback path,
2021-04-10 13:13:35 DEBUG (MainThread) [homeassistant.components.http.view] Serving /auth/external/callback to x.x.x.145 (auth: False)
or should there be a different one? I’ll dig in a bit more and see if I can find any other useful logs.
Hello @allenporter and thank you for your amazing work on the nest:
integration. I used it for the first time yesterday by following the API/project creation instructions and all worked to perfection. Few things I noticed are these:
- A nest CAM (especially one that is within a Nest Hub Max) if set to ‘OFF’ in the Nest mobile app spawns errors in the log of HA such as:
Logger: libav.rtsp
Source: components/stream/worker.py:106
First occurred: 6:39:17 PM (26 occurrences)
Last logged: 11:33:55 PM
method DESCRIBE failed: 404 Not Found
and
Logger: homeassistant.components.stream.worker
Source: components/stream/worker.py:131
Integration: Stream (documentation, issues)
First occurred: 7:24:34 AM (397 occurrences)
Last logged: 11:33:54 PM
Error opening stream rtsps://stream-eu1-charlie.dropcam.com:443/sdm_live_stream/<something_long>
Error opening stream rtsps://stream-eu1-charlie.dropcam.com:443/sdm_live_stream/<something_long>
Error opening stream rtsps://stream-eu1-charlie.dropcam.com:443/sdm_live_stream/<something_long>
Error opening stream rtsps://stream-eu1-charlie.dropcam.com:443/sdm_live_stream/<something_long>
Personally until now I was using the Nest Mobile App and I kept my cameras off until I needed to see something, in which case I was turning them on. I was hoping that I could follow the same premise by using the camera.turn_on
and camera.turn_off
services for these entities. However…
-
The documentation mentions nothing of the services available to the entities exposed after the integration is used. So for example I don’t know which of the following can be used or make no sense being able to be used and I was wondering if you could address that.
–camera.turn_on
> Fails with error if camera is ‘OFF’ through the Nest Mobile app and makes no sense using it when the camera is already on manually.
–camera.turn_off
> Makes no sense using it when the camera is already ‘OFF’ in the Nest Mobile App and doesn’t seem to do anything when the camera is ‘ON’. It spawns no error whatsoever.
–camera.record
+camera.play_stream
+camera.snapshot
> All these have been tested and work with nest cam exposed entities
–camera.enable_motion_detection
+camera.disable_motion_detection
> I don’t know if those services are usefull for something since motion detection is enabled through the permissions of the API which are set during the initial setup but it would be good to know if they actually contribute to something. -
Lastly I would like to ask whether the
stream:
integration is needed for nest cam entities exposed through thenest:
integration.
Thank you for any time you may take to read or respond to this.
@tsaro Ah, i missed that. Is that the request that either times out or fails? If so we should be able to find out whats going on… So does that end up writing anything in .storage/core.config_entries
?
I get a similar line for callback for either case, the first time the page loads quickly and I get lines as follows:
2021-04-10 14:28:34 DEBUG (MainThread) [homeassistant.components.http.view] Serving /auth/external/callback to x.x.x.145 (auth: False)
2021-04-10 14:28:34 DEBUG (MainThread) [homeassistant.components.http.auth] Authenticated x.x.x.145 for /api/config/config_entries/flow/43e9d86a08c84d58b772e925a599258b using bearer token
2021-04-10 14:28:34 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/config/config_entries/flow/43e9d86a08c84d58b772e925a599258b to x.x.x.145 (auth: True)
If I go back and click on the still-present ‘open website’ prompt, I don’t get the flow related lines after the callback one, and this page times out after a while rather than loading immediately.
2021-04-10 14:32:41 DEBUG (MainThread) [homeassistant.components.http.view] Serving /auth/external/callback to x.x.x.145 (auth: False)
I’m not sure if this message is related but slightly later I get some traceback info:
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-04-10 14:28:35 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
and no nest related entries show up in my .storage/core.config_entries file
@elementoulis Thanks for the kind words, and glad you were able to get things set up.
For the on
and off
bit, I am not currently aware any way to turn the camera on/off through the SDM API or any way for home assistant to know that it is off.
As for services, you’re right on – the ones you said work (record
, play_stream
, snapshot
) are the ones that work and the others. The on/off and enable/disable motion events are not exposed in the SDM API, so those are not used. (I could imagine suppressing events within home assistant, but I don’t think that is the intent of that service). Yes, it does make sense to update the documentation with this, good call out.
The stream
integration is definitely used by the nest integration to provide an HLS feed within home assistant, and was modified heavily to work to support nest
.
Thank you! (and I just saw you also replied to me on Discord - literally keeping an eye on everything!)
So I need to turn the cameras on through Nest (all the time) to have a consistent feed and commit/push the stream:
addition in my configuration to my production repos as what I am gathering from what you say is that it’s needed!
Will let you know if anything weird comes up in the logs to help further the development of nest:
as I have quite a few products myself!
Thanks again!
I’m getting constant rate limiting errors that make the integration practically useless. I’ve tried deleting and reconnecting the integration. I’ve tried setting up new projects and API access through Google cloud. Nothing seems to resolve the issue. A few other people in a different thread are experiencing the same issue. Any advice would be greatly appreciated.
The error in question that pops up in Lovelace after trying to adjust the thermostat is:
> Failed to call service climate/set_hvac_mode. Error from the API: 429: RESOURCE_EXHAUSTED: Rate limited for the Thermostat.: Too many Requests
I also see there is a github issue Rate Limited and Other API Errors Make Integration Unusable · Issue #49095 · home-assistant/core · GitHub filed this morning and a a few replies to that thread so likely is a change on the API side that many folks are experiencing. I’ll be following up in the github issue as I learn more.
I’d first start by checking the oauth consent screen since it sounded like OP of that thread was able to resolve it with that change until we learn more.
Hi Allen,
First of all superb work, the integration works great. I have one small question;
The temperature readings in Home Assistant are always just a few tenths off of the value that the Nest app displays.
I can imagine that the Nest app rounds the temperature readings, so that’s not an issue for me. But the setpoint: it is always *.3 or *.8 and not *.0 or *.5. Do you know if this is a common issue or if I configured something wrong?
If it’s an issue, I’ll can raise an issue on github if you prefer.
Thanks for all the effort!
Edit: I just managed to fix it myself. Switching the temperature in the nest app did reset the setpoint to *.5 & *.0.