core icon indicating copy to clipboard operation
core copied to clipboard

Home Assistant WebSocket API Error

Open bazsc20ne opened this issue 2 years ago • 5 comments

The problem

Hi,

I cannot change temperature on my Nest thermostat from Home Assistant. I see all the sensors and history, the data is reported correctly, but anytime I want to change the temperature or the operation mode or the preset, I get an error.

It stopped working under 2022.10.3, then I updated to 2022.10.4, but that didn't solve the issue. Then deleted the integration, created a new project in google's developer console and re-added the integration, but the issue is still there.

What version of Home Assistant Core has the issue?

core-2022.10.4

What was the last working version of Home Assistant Core?

core-2022.10.3

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

config_entry-nest-6524147ec8d0c7ffe535fb959cf18fdc.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/nest/climate_sdm.py:312
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 21:03:34 (5 occurrences)
Last logged: 21:12:35

[139974566139968] Error setting HVAC mode: Error from API: 404: NOT_FOUND: Requested entity was not found.: Not Found
[139975292572176] Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request
[139974545442224] Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 115, in _raise_for_status
    resp.raise_for_status()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('https://smartdevicemanagement.googleapis.com/v1/enterprises/673e3e9a-7d4f-49b4-bdde-e5d79bd5ed00/devices/AVPHwEsrRkDYryZbEqiV81CEp0FNZdyG_RtSL0E14bcad5WiuTAf_VU7lv4M_zYw8Ph4dWaSpI3ZEDk7-5FTicb1HyOWYQ:executeCommand')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 310, in async_set_temperature
    await trait.set_heat(temp)
  File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/thermostat_traits.py", line 145, in set_heat
    return await self._cmd.execute(data)
  File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/traits.py", line 31, in execute
    return await self._auth.post(f"{self._device_id}:executeCommand", json=data)
  File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 96, in post
    return await AbstractAuth._raise_for_status(resp)
  File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 120, in _raise_for_status
    raise ApiException(": ".join(detail)) from err
google_nest_sdm.exceptions.ApiException: Error from API: 404: NOT_FOUND: Requested entity was not found.: Not Found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 613, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 312, in async_set_temperature
    raise HomeAssistantError(f"Error setting HVAC mode: {err}") from err
homeassistant.exceptions.HomeAssistantError: Error setting HVAC mode: Error from API: 404: NOT_FOUND: Requested entity was not found.: Not Found

Additional information

No response

bazsc20ne avatar Oct 20 '22 19:10 bazsc20ne

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)


nest documentation nest source (message by IssueLinks)

home-assistant[bot] avatar Oct 20 '22 19:10 home-assistant[bot]

That is a different issue I think (I think there is another closed issue about it)

allenporter avatar Oct 20 '22 20:10 allenporter

Ok, feel free to point me over there if you want.

Was on mobile before: https://github.com/home-assistant/core/issues/75438 -- i'm deleting your comment since its a bit of noise on the wrong issue.

allenporter avatar Oct 21 '22 14:10 allenporter

@hallidaydaniel your issue is not related to the parent issue, see https://github.com/home-assistant/core/issues/75438

allenporter avatar Oct 21 '22 14:10 allenporter

i have the same issue

andreadannibale avatar Oct 24 '22 13:10 andreadannibale

I am getting "Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatEco.SetMode command not allowed in current thermostat mode.: Bad Request". This appears to have started this week.

This error is only happening when trying to set the PRESET_MODE. Automations trying to change the PRESET_MODE fail silently. Manually using the climate card in Home Assistant triggers the error on screen and in the logs.

Tangentially, I am having the same issue changing PRESET_MODE using the Alexa app on iOS to control Home Assistant devices. The official Google Skill in the Alexa app on iOS works, the Google Home app on iOS is working properly, as well as the Nest app on iOS.

Also note that the climate card shows the correct status quickly in Home Assistant if a successful change in PRESET_MODE is made from one of the non Home Assistant, working applications. This is simply not allowing a change in PRESET_MODE for me from within Home Assistant.

Changing all other settings in Home Assistant for my two Gen 1 Nest thermostats is working properly. Again, this is only affecting PRESET_MODE changes for me.

I have checked the Google cloud permissions and a few other things mentioned in other posts and all is proper. This setup has been working for me without fail for a considerable amount of time so I can't imagine it is anything more than some sort of API issue triggered recently at the Google mothership.

Hope this helps in some way and happy to do more troubleshooting.

brooksbennett avatar Oct 26 '22 00:10 brooksbennett

Your issue is not this issue, see my last update.

allenporter avatar Oct 26 '22 02:10 allenporter

having the same issue:

see also: [(https://www.googlenestcommunity.com/t5/Nest-Thermostats/Nest-integration-with-Home-Assistant-AND-Alexa-broken/td-p/264522)]

` Logger: homeassistant.components.websocket_api.http.connection Source: components/nest/climate_sdm.py:312 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 18:40:08 (2 occurrences) Last logged: 19:23:22

[140115670157296] Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request [140115420376480] Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 115, in _raise_for_status resp.raise_for_status() File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://smartdevicemanagement.googleapis.com/v1/enterprises/549065c1-4754-4a8c-b640-e27fdd27ee55/devices/AVPHwEs_dDntcCSp2scRLisbuGEc3vtSOtLFYbzvenHRn3JtxyatjkAjeNxxErO2egOlaSgZgTZbCgBWm8yExHU7gcpG0Q:executeCommand')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 310, in async_set_temperature await trait.set_heat(temp) File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/thermostat_traits.py", line 145, in set_heat return await self._cmd.execute(data) File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/traits.py", line 31, in execute return await self._auth.post(f"{self._device_id}:executeCommand", json=data) File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 96, in post return await AbstractAuth._raise_for_status(resp) File "/usr/local/lib/python3.10/site-packages/google_nest_sdm/auth.py", line 120, in _raise_for_status raise ApiException(": ".join(detail)) from err google_nest_sdm.exceptions.ApiException: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 202, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 207, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 613, in async_service_temperature_set await entity.async_set_temperature(**kwargs) File "/usr/src/homeassistant/homeassistant/components/nest/climate_sdm.py", line 312, in async_set_temperature raise HomeAssistantError(f"Error setting HVAC mode: {err}") from err homeassistant.exceptions.HomeAssistantError: Error setting HVAC mode: Error from API: 400: FAILED_PRECONDITION: sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat command not allowed in current thermostat mode.: Bad Request `

ronniebee avatar Oct 26 '22 20:10 ronniebee

Your issue is not the parent issue right?

allenporter avatar Oct 27 '22 01:10 allenporter

Your issue is not the parent issue right?

Glitch in the API seems to be clearing up on Google's side... I am now able to programmatically and manually make changes to PRESET_MODE...

brooksbennett avatar Oct 27 '22 13:10 brooksbennett

Your issue is not the parent issue right?

Glitch in the API seems to be clearing up on Google's side... I am now able to programmatically and manually make changes to PRESET_MODE...

Can confirm, I reloaded the integration to be sure and it is working as intended now

dejongmarten avatar Oct 27 '22 13:10 dejongmarten

Glad to hear the Google side fix resolved.things.

allenporter avatar Oct 27 '22 13:10 allenporter

Thanks, I can confirm it's working properly again.

bazsc20ne avatar Oct 31 '22 12:10 bazsc20ne

Same here. Everything works as expected now.

danielduerr avatar Oct 31 '22 14:10 danielduerr