Setting Nest temperature

so here I am all happy I have device trackers setting Nest to be Home or Away - that’s gonna be the hard part right?.. apparently not!

First off I am running 0.33.1 and have made a few fixes to get all the Nest components working (see GitHub for ‘unknown’ devices). When I try to set the temperature using this code :

service: climate.set_temperature
entity_id: climate.upstairs
target_temp_high: 19.0
target_temp_low: 17.0

I end up with this result :

homeassistant.core: Error doing job: Future exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/concurrent/futures/”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/”, line 1055, in execute_service
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/climate/”, line 259, in temperature_set_service
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/climate/”, line 171, in set_temperature
_LOGGER.debug(“Nest set_temperature-output-value=%s”, temp)
UnboundLocalError: local variable ‘temp’ referenced before assignment

Now I have tried also using target_temperature_high_c and just temperature but to no avail.
Anyone got any ideas???


Anyone setting a fixed temp for Nest’s using HA? Either using a scene or automation? Anyone have an example that works that could share their code?

it seems that the documented code doesn’t work. For anyone else looking to accomplish this :slight_smile:

service: climate.set_temperature
entity_id: climate.upstairs
temperature: 19




I have just set up my nest thermostat with HA, but still being new to the config file, how do I work this action, so I have something on the UI that I can change and have it sent/read via my nest ?

Many thanks in advance…


Would still appreciate any help from this community on how to can change the target temperature for the Nest Thermostat ?

I appreciate it is an old post and now that the heating season is starting in my country, I have only just got round to this. I found that you have to do two things:

Ensure that the Product you have created in your developer account has the correct read/write permissions. I fixed this but it would still not work.

It took me a day or 2 to figure out that you also have to log into your user account and accept the permission change - a bit like a mobile phone app. It’s all there in the documentation but took me a while to find it. :frowning_face:

Hope it helps someone anyway

This worked for me:

- service: climate.set_temperature
temperature: 17

Reviving this old thread as I am a new to HA/YAML and cannot seem to find a more current solution - do not know if syntax has changed with latest Google Nest Integration since the last post… Trying to change current Nest temperature target set point via automation, but Visual Editor only seems to support “Change HVAC mode…” or “Change preset…” with only two options being “none” or “eco”. Thought I could use Visual Editor to create initial YAML, then try above suggestions to change target set point temperature, but none seem to work - below is YAML being generated:

alias: Office Environment
description: Set Nest while in office

  • platform: device
    device_id: wwwwwwwwwwwwwwwwwww
    domain: media_player
    entity_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    type: turned_on
  • device_id: yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
    domain: climate
    entity_id: zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
    type: set_preset_mode
    preset_mode: none
    mode: single

Using HA Core: 2024.1.1
Using latest Google Nest integration

Obviously lost - any constructive guidance or feedback greatly appreciated. Regards.

Please format your code properly.

Based on what you posted it looks like you are setting triggers, not actions. A trigger is what needs to happen to begin your automation.

Setting the temperature target of a thermostat is done in the action section of an automation.

  - service: climate.set_temperature
      temperature: 67
      entity_id: climate.my_thermostat

From the automation UI, if you are on 2024.x or newer, you would select add action and then select climate and then set target temperature

1 Like

Thanks for the quick reply!

Looks like I jumped too quickly to YAML when I should have explored the options first!