When we are going to be away for a few days or more I like to put my Nest into Away/Eco mode to save money. However, I’ll often forget to take it out of Eco mode before getting home so I end up walking into a house that is too cold or hot.
To fix this, I a created an input_datetime variable to put the Nest back into normal operation before we arrive home.
My configurations and automations are below:
In your configuration.yaml file add this:
sensor:
# Used for the time trigger comparison
- platform: time_date
display_options:
- 'date_time'
input_datetime:
# The date/time to end away mode
nest_away_end:
name: End Nest away mode at
has_date: true
has_time: true
input_text:
# A variable to store Nest's current mode - used when we restore from away mode
nest_mode:
name: Heating/Cooling Mode
Putting Nest into Eco mode
The trigger I use to switch Nest into Eco mode is when my house enters an “away” mode I created (this isn’t related to Nest’s built-in away mode) - but you can change the trigger to anything. The following automation will only trigger if input_datetime.nest_away_end is set and is a future date from now() so it is safe to have this automation always fire when you leave the house.
If you wanted to get fancy, you could create a “start” input_datetime that puts Nest into Eco mode at a specific time. However, I find it simpler to set the nest_away_end input the morning of before we leave so the next time our house enters away mode the Nest automaton triggers.
- id: nest_away_start
# Set Nest into away (eco) mode when away mode is activated and if nest_away_end is set and a future time
alias: Boolean- Turn On Nest Away Mode
initial_state: 'on'
trigger:
- platform: state
entity_id: input_boolean.away_mode
to: 'on'
condition:
- condition: template
value_template: '{{ ( as_timestamp( now() ) | int ) < ( states.input_datetime.nest_away_end.attributes.timestamp | default(0) | int ) }}'
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'
The automation to take Nest out of Eco mode is based on the date/time set in the input variable
- id: turn_off_nest_away_mode
alias: Timer- Turn Off Nest Away Mode
initial_state: 'on'
trigger:
- platform: template
value_template: '{{ ( states.input_datetime.nest_away_end.attributes.timestamp | default(0) | int | timestamp_custom("%Y-%m-%d, %H:%M", True) ) == states.sensor.date__time.state }}'
condition:
condition: and
conditions:
# House is currently in eco mode
- condition: template
value_template: '{{ is_state_attr("climate.house_nest", "operation_mode", "eco") }}'
# The last state was successfully saved/set
- condition: template
value_template: '{{ states.input_text.nest_mode.state != "unknown" }}'
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 }}'
Make sure to rename climate.house_nest to whatever the entity name of your Nest is called.