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 :

action:
service: climate.set_temperature
entity_id: climate.upstairs
data:
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/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/core.py”, line 1055, in execute_service
service_handler.func(service_call)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/climate/init.py”, line 259, in temperature_set_service
climate.set_temperature(**kwargs)
File “/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/climate/nest.py”, 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???

pjo

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:

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

pjo

2 Likes

Hi

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…

Hi,

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:

action:
- service: climate.set_temperature
data:
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
trigger:

  • platform: device
    device_id: wwwwwwwwwwwwwwwwwww
    domain: media_player
    entity_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    type: turned_on
    condition:
    action:
  • 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.

action:
  - service: climate.set_temperature
    data:
      temperature: 67
    target:
      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!