New Climate Integration, Nest

Hey All:

I have a couple of questions that I can’t seem to solve easily. I’ve upgraded to 0.96.3. I have a Nest thermostat (for now). Everything was working.

I use several automations to have HA control the Nest. Nest doesn’t have any scheduling set up anymore. Now I’m trying to reconfigure the automations.

Issue 1
I understand that under the new Climate, the HVAC modes (formerly operations modes) are:

  • Auto (used for on-device scheduling or AI)
  • Heat (heat home to given temperature)
  • Cool (cool home to given temperature)
  • Heat_Cool (set a range and use heat or cool to keep within range)
  • Off

However, my Nest only broadcasts auto, heat, cool, and off. I do not seem to have heat_cool as an hvac_mode.

Question 1: Does this mean that Nest should use “auto” to keep the temperature between given temperatures even if its scheduling and AI are off?

Issue 2
I also see that instead of an “away mode” we’re using “presets”. Those presets (at least on my Nest) are “None” (which reports “null” on the states screen), “Away”, and “Eco”. Traditionally, Away Mode would allow us to set essentially heat_cool mode (or “auto” as it was known) to a super-wide set of temperatures (hot and cold) so that the house didn’t get extreme while we were gone.

Question 2: What is the difference between “Away” and “Eco” presets?

Question 3: Do we call these presets even if we are still using Nest, or do we continue to use the nest_set_mode services and “home” and “away”?

I use several automations to screw with the temperature in my house at various times (e.g. cooler for nights, start cooling later on non-worknights because I stay up later, and help my wife stop air conditioning the neighbourhood by changing the mode to ‘away’ when she leaves the damned door to the patio open, but I digress). They all use a conditions check to see if the Nest is in ‘away’ mode - if not, then they don’t run at all to preserve the ‘away’ settings.

Question 4: How do we check to see if the preset mode is “None” using templates? My Nest is right now not using any of the presets right now (state shows “null”), but {{is_state_attr(‘climate.upstairs’,‘preset_mode’,‘null’)}} returns “False”.

–edit-- in respect of this issue of Auto vs. Eco mode, I see that the changes were deliberate in the Climate 1.0 Revision (https://github.com/home-assistant/home-assistant/commit/84cf76ba3688760fc311733a3f179865f1317c67#diff-7ebbeb298e23668148029b5f62150a15) so it’s probably a situation where I need the help of our wonderful and talented maintainers, right?

Thanks a ton for all your help everyone.

2 Likes

I’m running into some issues adapting my automations to the new interface.

I tried using the preset modes, and setting to “eco” when I was away, and “none” when I am home,

However, when setting to “none” I get the error: “Invalid HVAC mode: Auto”. Which is weird because

  1. HVAC mode auto is valid
  2. I don’t want auto HVAC mode, I want cool mode which is what it’s setup for.

So basically, I just want a way to turn eco on/off, or be able to set home/away. I don’t see any way to do either at this time.

Investigating more, there appears to be two issues:

  1. Preset “None” put the Nest into eco mode, obviously wrong
  2. Preset “None” and “Away” generate “Invalid HVAC mode: Auto” errors.

There is an issue kind of tracking this problem:
https://github.com/home-assistant/home-assistant/issues/25427

I had each and every one of those questions too. Thanks for taking the time to ask them so clearly. This latest update broke more automations than I think all others combined for me and it has been painful!

I’m going to save this thread and come back to it when I have time to start investigating and fixing my stuff.

to be honest, I felt kind of dumb asking the question. But given that the only replies have been to follow up on my own question, apparently I wasn’t that dumb.

I see the latest bug report about 10 minutes ago saying that the Eco mode has problems. I have set up some automations using “away” which seem to work, but my two questions remain. I have tagged @balloob in the GitHub bug report, as if he isn’t busy enough with his myriad of Home assistant changes. He is the guy who wrote the integration for climate 1.0 for the nest. Sadly I think he is the only one who can answer my questions.

I have not had this problem. How did you call none to put the nest into eco mode? I have used climate. set_preset_mode with “none” to get out of the “away” preset.

I switch the preset mode from the climate lovelace card. I seem to get unpredictable results.

Hi all,

I have submitted this issue specific to the problem of not being able to switch from eco preset back to normal:
https://github.com/home-assistant/home-assistant/issues/25451

Reading this thread and the related github issues, I’m not sure everything is solved (might be with 0.96.5) but this what I did after 0.96 update. I had this running before that update but made changes based on the climate code changes. In the past, I had to store the previous Nest state before going into ECO mode. When returning from ECO mode, I read the text value that represents previous state and then apply that mode. Oh, and I borrowed this from another person, although I can’t remember who now.

These are scripts that I call with other automation.

nest_eco:
  sequence:
  - data_template:
      entity_id: input_text.nest_mode
      value: '{{ states.climate.downstairs_downstairs }}'
    service: input_text.set_value
  - data:
      preset_mode: eco
    entity_id: all
    service: climate.set_preset_mode

nest_home:
  sequence:
    service: climate.set_hvac_mode
    entity_id: all
    data_template:
      hvac_mode: '{{ states.input_text.nest_mode.state }}'
1 Like

Sorry to dig up this thread, but it sounds like the issue where returning from Eco or Away modes will always set your Nest to “Heat and Cool” instead of its previous state was supposed to have been fixed? I’m still seeing this behavior though (on 0.98.3).

I’m using “climate.set_preset_mode” to switch between “away” and “none” – is this not the best practice? Thanks in advance!

I’ve been using the Nest integration with a Nest Thermostat on HA 0.95.4 for a while. I had automations/scripts to turn on ECO mode when nobody was home, and to restore the previous mode (cool, heat, etc.) when someone arrives home. I did a similar thing that @mostlychris described, i.e., saved the current state to an input_text, and then used that when restoring the state.

I’m now preparing to upgrade to 0.98.3. I just ran an experiment with 0.98.3 and discovered if I call climate.set_preset_mode with preset_mode set to eco it turns on ECO mode (like climate.set_operation_mode with operation_mode set to eco used to.) And to turn off ECO mode, and go back to the previous mode, instead of calling climate.set_preset_mode with preset_mode set to none, I called climate.set_hvac_mode with hvac_mode set to the previous mode (just like I used to do with climate.set_operation_mode.) This seems to do the trick.

EDIT: So this is what I’ve found should work with 0.98.3 (although I haven’t thoroughly tested it yet):

sensor:
  - platform: template
    sensors:
      kitchen_thermostat_hvac_mode:
        value_template: >
          {% if is_state_attr('climate.kitchen', 'preset_mode', 'eco') %}
            eco
          {% else %}
            {{ states('climate.kitchen') }}
          {% endif %}

The above allows me to use one entity to check the current operational mode and save it for use in restoring the mode. This is effectively equivalent to what the climate entity’s state used to be.

script:
  nest_eco_on:
    alias: Nest Thermostat - Set to ECO mode
    sequence:
      # Only turn on ECO mode if thermostat is not off and not already in ECO
      # mode.
      - condition: template
        value_template: >
          {{ states('sensor.kitchen_thermostat_hvac_mode')
             not in ['off', 'eco'] }}
      # Save current operation mode.
      - service: input_text.set_value
        entity_id: input_text.previous_hvac_mode
        data_template:
          value: "{{ states('sensor.kitchen_thermostat_hvac_mode') }}"
      # Turn on ECO mode.
      - service: climate.set_preset_mode
        entity_id: climate.kitchen
        data:
          preset_mode: eco

  nest_eco_off:
    alias: Nest Thermostat - Return from ECO mode
    sequence:
      # Only set back to previous mode if thermostat is still in ECO mode.
      - condition: template
        value_template: >
          {{ is_state('sensor.kitchen_thermostat_hvac_mode', 'eco') }}
      # Restore previous operation mode.
      - service: climate.set_hvac_mode
        entity_id: climate.kitchen
        data_template:
          hvac_mode: "{{ states('input_text.previous_hvac_mode') }}"

So now instead of using one service (climate.set_operation_mode) I use two (climate.set_preset_mode and climate.set_hvac_mode.)

It’s a bit of a shame that the climate component has become harder to use instead of easier, but I guess that’s the trade-off with standardizing across different thermostats, etc.

1 Like

This seems to be working perfectly for me the past few days - thank you so much!

1 Like

Hey Guys I know this is an old thread but I am trying to get this to work and both scripts above give me this error in my log

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/core.py”, line 1240, in _safe_execute
await self._execute_service(handler, service_call)
File “/usr/src/homeassistant/homeassistant/core.py”, line 1255, in _execute_service
await handler.func(service_call)
File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 207, in service_handler
await script.async_turn_on(variables=service.data, context=service.context)
File “/usr/src/homeassistant/homeassistant/components/script/init.py”, line 284, in async_turn_on
await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 802, in async_run
await run.async_run()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 523, in async_run
await self._async_run()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 540, in _async_run
await self._async_step(log_exceptions=not propagate_exceptions)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 154, in _async_step
self, f"async{cv.determine_script_action(self._action)}_step"
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 624, in _async_call_service_step
*self._prep_call_service_step(), blocking=True, context=self._context
File “/usr/src/homeassistant/homeassistant/core.py”, line 1210, in async_call
processed_data = handler.schema(service_data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 208, in call
return self._exec((Schema(val) for val in self.validators), v)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 287, in _exec
raise e if self.msg is None else AllInvalid(self.msg, path=path)
File “/usr/local/lib/python3.7/site-packages/voluptuous/validators.py”, line 283, in _exec
v = func(v)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled([], data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 817, in validate_callable
return schema(data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 272, in call
return self._compiled([], data)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 594, in validate_dict
return base_validate(path, iteritems(data), out)
File “/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py”, line 432, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: value is not allowed for dictionary value @ data[‘hvac_mode’]

Did I make an error somewhere or does this no longer work?