Nest Automation Help

Hi,
I need some assistance setting up an automation to keep my nest thermostat in “home mode” while any one is home by using device tracker.

Not sure if my config is formatted correctly, for if only one of us is home.

The following is my config, if I trigger the automation manually it works, if my phone goes from away to home it works, but it doesn’t trigger / stay on if I’m already home and nest switches to away mode?

Automation=

- alias: "Nest Home Mode"
  trigger:
    - platform: template
      value_template: "{% if is_state('device_tracker.my_phone', 'home') %}true{% endif %}"
    - platform: template
      value_template: "{% if is_state('device_tracker.wife_phone', 'home') %}true{% endif %}"
  condition:
    - condition: state
      entity_id: climate.living_room
      state: eco
  action:
    - service: script.turn_on
      entity_id: script.nest_home_mode

Script=

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

Add another state trigger on the thermostat state change.
BUT, you’ll have to add and OR conditions as well to ensure someone is home.

Thanks for the response.

I ended up flipping the platform and condition, and it now works.

Here’s the automation I ended up with:

- alias: "Nest Home Mode"
  trigger:
    - platform: state
      entity_id: climate.living_room
      to: 'eco'
  condition:
    condition: or
    conditions:
      - condition: state
        entity_id: 'device_tracker.my_phone'
        state: 'home'
      - condition: state
        entity_id: 'device_tracker.wife_phone'
        state: 'home'
  action:
    - service: script.turn_on
      entity_id: script.nest_home_mode
1 Like

Nice work, I had been planning on doing this and finally got around to writing the automation.

Question I have is, is this needed because Nest only assumes someone is home or away based on the sensor of the thermostat actually seeing motion or not seeing motion for x period of time? Just curious because it would be nice to set presence another way so that you don’t have to wait for the eco mode to go on.

Mainly, yes.