Thermostat automation in HA

I have a ZWave Thermostat T6, I am coming from Hubitat. Hubitat allowed me to automate thermostat by scheduling a setpoint for every day.

Does HA has such functionality?

Hi, you can use the automations which can be found in sidebar>configurations>automations.
Or you can use the scheduler card

1 Like

Thank you, This is helpful. I am looking for something more complex.

Every day at sunrise(If anyone home), set thermostat to 70
If everyone is away, turn off thermostat
If everyone is in home, set the thermostat back to 70

1 Like

Assuming that you already have integrated your thermostat and device trackers with HA, we can use an automation. I have made a sample yaml for you but you have to edit the entity_ids and services according to your setup. I will explain the yaml in the later.

alias: Thermostat Automation
description: ''
mode: single
trigger:
  - platform: sun
    event: sunrise
condition: []
action:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: device_tracker.fatherphone
                state: home
              - condition: state
                entity_id: device_tracker.brophone
                state: home
        sequence:
          - service: climate.set_temperature
            data:
              temperature: 70
            entity_id: climate.thermostat
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: device_tracker.fatherphone
                state: not_home
              - condition: state
                entity_id: device_tracker.brophone
                state: not_home
        sequence:
          - service: climate.turn_off
            data: {}
            entity_id: climate.thermostat
          - wait_for_trigger:
              - platform: state
                entity_id: device_tracker.fatherphone
                to: home
              - platform: state
                entity_id: device_tracker.brophone
                to: home
          - service: climate.set_temperature
            data:
              temperature: 70
            entity_id: climate.thermostat
    default: []

If you are not familiar with copying yamls to automations, just follow this procedure.

Now let me explain the yaml. The first part of yaml is the name and then comes the trigger which i have put as sunrise. So the automation will be executed at sunrise. Next comes the action part where I have chosen the choose action type. This enables me to specify two or paths of action according to conditions. In our case the conditions are either some one is at home or all are away. For each of these conditions I have set the actions. in the first case i,e at least some is at home, the thermostat is set to 70 by calling the climate.set_temperature service and the automation exits after that. If the second condition is valid i,e no one is there, then the thermostat is switched off with climate.turn_off service and the autmation waits for someone to be back home and as soon as it happens the thermostat is set to 70 and automation exits.

In this script you have to change the entity_id of the thermostat and device_trackers. Also a tip, please use a ping or any other router based device tracker as it would be best suited for this. if you are using a gps based device_tracker we may need to change the device trackers accordingly.

You might be having doubts about this, Please let me know and i can help you out.

Thanks a lot. Very helpful