Error Taking Nest Out of Eco Mode

Hello,

I’m trying to take my Nest Thermostat out of eco mode (the new"er" name for away mode).

According to the documentation at https://www.home-assistant.io/components/nest/ the following action should work:

  action:
    # Turn off away (eco) mode for Nest
    - service: nest.set_mode
      data:
        home_mode: home

But it doesn’t, I’m getting an error:

Log Details (ERROR)
Sat Mar 31 2018 11:14:58 GMT-0400 (EDT)

Error executing service <ServiceCall climate.set_away_mode: away_mode=False>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1006, in _event_to_service_call
    await service_handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/__init__.py", line 256, in async_away_mode_set_service
    await climate.async_turn_away_mode_off()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/climate/nest.py", line 203, in turn_away_mode_off
    self.structure.away = False
  File "/home/ha/.homeassistant/deps/lib/python3.6/site-packages/nest/nest.py", line 1269, in away
    self._set_away(value)
  File "/home/ha/.homeassistant/deps/lib/python3.6/site-packages/nest/nest.py", line 1261, in _set_away
    self._set('structures', {'away': AWAY_MAP[value]})
  File "/home/ha/.homeassistant/deps/lib/python3.6/site-packages/nest/nest.py", line 168, in _set
    response = self._nest_api._put(path=path, data=data)
  File "/home/ha/.homeassistant/deps/lib/python3.6/site-packages/nest/nest.py", line 1590, in _put
    return self._request('PUT', path, data=data)
  File "/home/ha/.homeassistant/deps/lib/python3.6/site-packages/nest/nest.py", line 1582, in _request
    raise APIError(response)
nest.nest.APIError: blocked

Turning on eco mode for the Nest does work and I use this action:

  action:
    # Turn on away (eco) mode for Nest
    - service: nest.set_mode
      data:
        home_mode: away

Could this be a bug with the nest component or is the documentation not up-to-date?

See the second automation in this file for how I turn away mode off.

https://github.com/SilvrrGIT/HomeAssistant/blob/master/automation/nest.yaml

You can also use a script call with your automation.

Script:

alias: Nest Home Mode
sequence:
  - service: nest.set_mode
    data:
      home_mode: home

Automation:

  action:
    service: script.turn_on
    entity_id: script.nest_home_mode

Did you try including the entity?
I haven’t done it this way, but it’s worth a shot, I just follow the docs on using scripts to set the mode.

  action:
    service: nest.set_mode
    entity_id: climate,XXX
      data:
        home_mode: home

That is the work around I ended up using as well, set operation mode.

Is there a point to setting away mode to on or off with Nest and HA? I program and control the thermostat only though Nest.

I didn’t because the documentation said it was optional.

And it did go into away mode, just the Nest wasn’t set into its away mode, eco, so I decided to take the route of changing the operation of the Nest to eco.

  action:
    # Save the current mode for Nest so we can restore it later
    - service: input_text.set_value
      data_template:
        entity_id: input_text.nest_mode
        value: '{{ states.climate.house_nest.attributes.operation_mode }}'
    # Set Nest to Eco mode
    - service: climate.set_operation_mode
      data:
        entity_id: climate.house_nest
        operation_mode: 'eco'

I am also saving the current Nest operation mode to an input_text so I can restore it to the same mode (haet, heat/cool, cool).

I’ve been thinking of adding in an automation to do the same considering my wife doesn’t have the Nest app on her phone and ever since Nest added Eco mode it doesn’t seem to switch into Away/Eco mode anymore when neither of us are home.

So what I’m gathering from here is that in order to do this, you would need to set the operation mode to eco, then set to another mode on return. The problem here is it’s currently summer, so obviously I’d want to set to cool. But come winter time would I need to change the automation to set cool to heat instead? I don’t want to have to remember to do this when the time comes to change it. Is there a way to query the current mode prior to changing to eco, then on return, set back to the previous operation mode since it seems like you can’t just toggle eco mode on/off like you could with away mode?

I had the exact same thought, throughout the year my Nest is set to Heat, Heat/Cool, and Cool. So to solve this issue I created an input_text component that saves the state of the Nest before it is set to Eco mode. When I am ready to set the Nest back to normal operation, I use the value that was set in the input_text component.

In your configuration.yaml file add this:

input_text:
  nest_mode:
    name: Heating/Cooling Mode

When you want to put your Nest into Eco mode your automation action would be:

  action:
    # Save the current mode for Nest so we can restore it later
    - service: input_text.set_value
      data_template:
        entity_id: input_text.nest_mode
        value: '{{ states.climate.house_nest.attributes.operation_mode }}'
    # Set Nest to Eco mode
    - service: climate.set_operation_mode
      data:
        entity_id: climate.house_nest
        operation_mode: 'eco'

When you want to take your Nest out of Eco mode your automation action would be:

  action:
    # Restore Nest to the orgional mode
    - service: climate.set_operation_mode
      data_template:
        entity_id: climate.house_nest
        operation_mode: '{{ states.input_text.nest_mode.state }}'

I have a condition in my automation that checks the input_text.nest_mode != “unknown” so it will only trigger if the mode was successfully set.

I didn’t share all of my Nest automations because I didn’t want to make the post too long or complex but the way I use these actions are as following.

  1. I have an input_datetime select in the HA interface that I set the date and time that I want Nest to come out of Eco mode.

  2. If the input_datetime has a value that is greater than the current time (so if it is in the future) then when I leave the house (away mode) the Nest is automatically set to Eco mode. (If you wanted to, you could create another input_datetime and use that as a start Eco mode trigger)

  3. The time trigger to take the Nest out of Eco mode is the value of the input_datetime (that way I don’t come home from a trip and the house is too hot or cold).

If you want, I’m glad to share the full automations and configurations. There are a few gotchas I discovered when I wrote this 4 months ago and I’m glad to write it all up and share.

3 Likes

Id be interested in seeing this.

Here you go: