core: Nest Thermostat integration stops working

The problem

Nest thermostat integration (using the Google Cloud API) works normally for several hours or even days but then fails and the integration needs to be reloaded to work again. It seems that the more recent versions of core have made this problem worse as I am now having to restart the integration almost daily.

Integration will show as “Off” with no other modes when it has failed. Reloading the integration restores the normal HVAC modes. Looking at the history for the device when the integration has failed, it will show that it was turned off at some point earlier although there was nothing commanding it to do so.

What version of Home Assistant Core has the issue?

core-2023.4.5

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/

Diagnostics information

{ “home_assistant”: { “installation_type”: “Home Assistant OS”, “version”: “2023.4.5”, “dev”: false, “hassio”: true, “virtualenv”: false, “python_version”: “3.10.10”, “docker”: true, “arch”: “x86_64”, “timezone”: “America/Los_Angeles”, “os_name”: “Linux”, “os_version”: “6.1.24”, “supervisor”: “2023.04.1”, “host_os”: “Home Assistant OS 10.0”, “docker_version”: “23.0.3”, “chassis”: “embedded”, “run_as_root”: true }, “custom_components”: { “frigate”: { “version”: “4.0.0”, “requirements”: [ “pytz==2022.7” ] }, “hacs”: { “version”: “1.32.1”, “requirements”: [ “aiogithubapi>=22.10.1” ] } }, “integration_manifest”: { “domain”: “nest”, “name”: “Google Nest”, “after_dependencies”: [ “media_source” ], “codeowners”: [ “@allenporter” ], “config_flow”: true, “dependencies”: [ “ffmpeg”, “http”, “application_credentials” ], “dhcp”: [ { “macaddress”: “18B430*” }, { “macaddress”: “641666*” }, { “macaddress”: “D8EB46*” } ], “documentation”: “https://www.home-assistant.io/integrations/nest”, “iot_class”: “cloud_push”, “loggers”: [ “google_nest_sdm”, “nest” ], “quality_scale”: “platinum”, “requirements”: [ “python-nest==4.2.0”, “google-nest-sdm==2.2.4” ], “is_built_in”: true }, “data”: { “data”: { “name”: “REDACTED”, “type”: “sdm.devices.types.THERMOSTAT”, “assignee”: “REDACTED”, “traits”: { “sdm.devices.traits.Info”: { “customName”: “REDACTED” }, “sdm.devices.traits.Humidity”: { “ambientHumidityPercent”: 64 }, “sdm.devices.traits.Connectivity”: { “status”: “ONLINE” }, “sdm.devices.traits.Fan”: { “timerMode”: “OFF” }, “sdm.devices.traits.ThermostatMode”: { “mode”: “HEATCOOL”, “availableModes”: [ “HEAT”, “COOL”, “HEATCOOL”, “OFF” ] }, “sdm.devices.traits.ThermostatEco”: { “availableModes”: [ “OFF”, “MANUAL_ECO” ], “mode”: “OFF”, “heatCelsius”: 15.555527, “coolCelsius”: 29.444397 }, “sdm.devices.traits.ThermostatHvac”: { “status”: “OFF” }, “sdm.devices.traits.Settings”: { “temperatureScale”: “FAHRENHEIT” }, “sdm.devices.traits.ThermostatTemperatureSetpoint”: { “heatCelsius”: 20.555555, “coolCelsius”: 23.333334 }, “sdm.devices.traits.Temperature”: { “ambientTemperatureCelsius”: 20.839996 } }, “parentRelations”: [ { “parent”: “REDACTED”, “displayName”: “REDACTED” } ] }, “command”: { “sdm.devices.commands.ThermostatMode.SetMode_count”: 1, “sdm.devices.commands.ThermostatMode.SetMode_sum”: 755, “sdm.devices.commands.Fan.SetTimer_count”: 1, “sdm.devices.commands.Fan.SetTimer_sum”: 771 }, “event_media”: { “event”: 6 } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 287, in async_set_hvac_mode
raise ValueError(f"Unsupported hvac_mode '{hvac_mode}'")
ValueError: Unsupported hvac_mode 'heat_cool'
2023-05-09 19:30:00.195 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139724931415632] Unsupported hvac_mode 'heat_cool'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 287, in async_set_hvac_mode
raise ValueError(f"Unsupported hvac_mode '{hvac_mode}'")
ValueError: Unsupported hvac_mode 'heat_cool'
2023-05-09 19:51:25.585 WARNING (MainThread) [homeassistant.components.websocket_api.http.connection] [139724872852112] Disconnected: Did not receive auth message within 10 seconds
2023-05-09 20:00:00.203 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139724931415632] Unsupported hvac_mode 'heat_cool'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 287, in async_set_hvac_mode
raise ValueError(f"Unsupported hvac_mode '{hvac_mode}'")
ValueError: Unsupported hvac_mode 'heat_cool'
2023-05-09 20:30:00.223 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139724931415632] Unsupported hvac_mode 'heat_cool'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 287, in async_set_hvac_mode
raise ValueError(f"Unsupported hvac_mode '{hvac_mode}'")
ValueError: Unsupported hvac_mode 'heat_cool'

Additional information

No response

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 62 (29 by maintainers)

Most upvoted comments

I’ve opened an issue with Google here:

Google Issue Tracker 291659614

I’ve noticed the issue appears to be related to a persistent state between HA and the Nest API. Once the error occurs, it will continue to occur until the integration is reloaded. Once the integration is reloaded, the error stops occurring.

@aredon please file a new issue and include all relevant information in the issue template.

Some months ago (beginning of this year? Can’t find the issues from that time) there was some big Google Nest/HA outrage. Since that moment I needed to re-auth every ~7 days.

Today took some time to dive into this, found some post on HA community saying that when the “OAuth consent screen” is on “testing mode”, you need to re-auth every ~7 days.

Checked my settings, and yes; I had “testing mode” on. Switched to production right now, hoping the issue will disapear.

Will keep you guys updated! (As I want this to be working again before the winter… Otherwise I need to find some alternative to my Nest Thermostat)

What’s better than +1 is to include detailed bug reports with debug logs showing the incorrect messages published.

@allenporter - I managed to capture the issue (it happened briefly again this morning). I pasted problem code with eventID info into the above Google issues report. Hope that helps. Thanks again for all your guidance!

Oh no just to clarify, see my update above https://github.com/home-assistant/core/issues/92927#issuecomment-1639179479 this is a google nest publisher issue, not a home assistant bug.

The way the integration works is that it polls the API on startup, then uses the subscriber API to efficiently be notified about updates to devices immediately as soon as they happen – rather than polling constantly and inefficiently. The nest API is incorrectly publishing a command that says: “Your thermostat does not support heating or cooling” and home assistant honors that. On restart, the API returns the right response.

This is a nest publisher bug that is very important to be resolved.

@ianwood your bug report includes the eco trait, which is fine. You need to include an example with sdm.devices.traits.ThermostatMode like i included.

I am also seeing problems with thermostat not responding to the ThermostatTemperatureSetpoint.SetRange command when submitted via the homeassistant Nest integration, however when manipulated via the native Nest mobile app, temperature can be set just fine.

Earlier I was seeing a 429 resource exhausted response for every set temperature API call from the UI. I tried deleting the integration and creating a new oauth ID and new device access project. Now, I don’t see those errors, but no change takes effect.

I am running 2023.6.2 by the way and here is diagnostic from Nest integration config_entry-nest-776cc3d0f37c2b3f3c9262fdf8fc73ef.json.txt

Example logs:

2023-06-16 23:45:12.458 DEBUG (MainThread) [google_nest_sdm.auth] request[post]=https://smartdevicemanagement.google
apis.com/v1/enterprises/199609fb-94b3-4221-81f5-9fb52175674d/devices/AVPHwEsfPQD9JnY7SN88XZDFZk2AJQ28qihbYDBj7Huu7n7
c0CbmBlzBOZe88LNauKfT_x_kmXc8DKwfa4RiI6GzStZCoQ:executeCommand
2023-06-16 23:45:12.459 DEBUG (MainThread) [google_nest_sdm.auth] request[post json]={'command': 'sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange', 'params': {'heatCelsius': 18.333333333333332, 'coolCelsius': 29.444444444444443}}

When I make changes via the native Nest app, the temperature updates do come through and show on the UI, so that part is working:

2023-06-16 23:52:15.151 DEBUG (MainThread) [google_nest_sdm.event] EventMessage raw_data={'eventId': 'c3c38f78-b648-4d8f-941e-26a1a423e91f', 'timestamp': '2023-06-17T06:52:12.681Z', 'resourceUpdate': {'name': 'enterprises/199609fb-94b3-4221-81f5-9fb52175674d/devices/AVPHwEsfPQD9JnY7SN88XZDFZk2AJQ28qihbYDBj7Huu7n7c0CbmBlzBOZe88LNauKfT_x_kmXc8DKwfa4RiI6GzStZCoQ', 'traits': {'sdm.devices.traits.ThermostatTemperatureSetpoint': {'heatCelsius': 11.666667, 'coolCelsius': 29.444445}}}, 'userId': 'AVPHwEuroOkzYgoJkQLhUab9gQWLi4O3jYgai5pEWLdE', 'resourceGroup': ['enterprises/199609fb-94b3-4221-81f5-9fb52175674d/devices/AVPHwEsfPQD9JnY7SN88XZDFZk2AJQ28qihbYDBj7Huu7n7c0CbmBlzBOZe88LNauKfT_x_kmXc8DKwfa4RiI6GzStZCoQ']}