How do you sync the target temp on 2 thermostats?

I have 2 thermostats, one upstairs (ecobee) and one downstairs (trane zwave). The thermostat downstairs is not actually connected in anyway to my hvac system. Id like to just use it to control the Ecobee upstairs but both thermostats need to match modes and set temperatures.
Currently I have a working automation that is able to update either thermostat’s mode so they are both the same.
That automation looks like this:

- alias: 'Basement Thermostat Match Ecobee Mode'
  trigger:
    - platform: state
      entity_id: climate.thermostat
  action:
    service: climate.set_hvac_mode
    entity_id: climate.basement_thermostat
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"
      
- alias: 'Ecobee Match Basement Thermostat Mode'
  trigger:
    - platform: state
      entity_id: climate.basement_thermostat
  action:
    service: climate.set_hvac_mode
    entity_id: climate.thermostat
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"

I’m wanting to also match set temperature. So if for example, I set one thermostat mode to heat_cool and adjust the target_temp_high and target_temp_low it will reflect the same on the other thermostat.
My research suggests maybe creating a sensor using a value template might be what I’m looking for but honestly I’m not sure how to create that correctly and implement it into an automation.

1 Like

I was able to figure out how to create a sensor that shows the current values of target_temp_high and target_temp_low which looks like this:

- platform: template
  sensors:
    ecobee_target_temp_high:
      unit_of_measurement: '°F'
      value_template: '{{ states.climate.thermostat.attributes.target_temp_high }}'
- platform: template
  sensors:
    ecobee_target_temp_low:
      unit_of_measurement: '°F'
      value_template: '{{ states.climate.thermostat.attributes.target_temp_low }}'

Now I just need help creating an automation that when that sensor state changes it will set the target temp of the basement thermostat to the same value.

Thank in advance for any help!

I was able to sync both thermostats target_temp_high and target_temp_low with the following automation:

- alias: 'Basement Thermostat Set Temperature'
  trigger:
    - platform: state
      entity_id: sensor.ecobee_target_temp_high
    - platform: state
      entity_id: sensor.ecobee_target_temp_low
  action:
    - service: climate.set_temperature
      entity_id: climate.basement_thermostat    
      data_template:
        target_temp_high: "{{ states.climate['thermostat'].attributes.target_temp_high }}" 
        target_temp_low: "{{ states.climate['thermostat'].attributes.target_temp_low }}"  

- alias: 'Ecobee Thermostat Set Temperature'
  trigger:
    - platform: state
      entity_id: sensor.basement_target_temp_high
    - platform: state
      entity_id: sensor.basement_target_temp_low
  action:
    - service: climate.set_temperature
      entity_id: climate.thermostat    
      data_template:
        target_temp_high: "{{ states.climate['basement_thermostat'].attributes.target_temp_high }}" 
        target_temp_low: "{{ states.climate['basement_thermostat'].attributes.target_temp_low }}"

Hi I am also trying to get same result. I have a BECO Thermostat which communicates via mqtt with home assistant. Now I want to “sync” those two climate entities.

So far I copied your code but it throws an error :slight_smile:

ac_bedroom_hvac_mode_controller:
  alias: 'AC Bedroom Control Sync hvac Mode'
  trigger:
    platform: state
    entity_id: climate.bedroom_ac_control
  action:
    service: climate.set_hvac_mode
    entity_id: climate.air_conditioner_bedroom
    data_template:
      hvac_mode: "{{ trigger.to_state.state }}"

Error:

2020-06-01 22:44:16 ERROR (MainThread) [homeassistant.components.automation] AC Sync Bedroom: Error executing script. Invalid data for call_service at pos 1: required key not provided @ data['hvac_mode']

hmm your code looks correct.

If you go to Developer Tools > States and select one of your thermostats. Note the options for hvac_modes. Then check the other thermostat and see if it has the same options for hvac_modes. Possibly if they don’t have the same options they wont be able to sync correctly.
Also, what version of HA are you running? I’m on 110.4 currently and my original code is still working.

image

Thanks @guy0nabuffalo.

My “dummy” climate Thermostat has this hvac_modes:

hvac_modes:
  - heat
  - cool
  - auto
  - fan_only
  - 'off'
min_temp: 16
max_temp: 32
target_temp_step: 1
fan_modes:
  - auto
  - low
  - medium
  - high
preset_modes:
  - none
  - away
current_temperature: 23
temperature: 19.5
fan_mode: high
hvac_action: 'off'
preset_mode: null
friendly_name: Bedroom AC Control
supported_features: 25

The climate to control has:

hvac_modes:
  - cool
  - heat
  - dry
  - auto
  - fan_only
  - 'off'
min_temp: 16
max_temp: 32
target_temp_step: 1
fan_modes:
  - low
  - medium
  - high
  - auto
current_temperature: 25.7
fan_mode: low
last_hvac_mode: fan_only
last_fan_mode: low
last_preset_mode: null
friendly_name: Air Conditioner Bedroom
supported_features: 8

Well

theres hvac_action in dummy and last_hvac_mode in the "ral climate but hvac mode is the same

Worked :stuck_out_tongue: i had a script format used for the automation :stuck_out_tongue:

Glad you got it figured out!

New issue … When I run the opposites automation it will run off and mode x all the time .

Do you have an idea how I can sync both climate entities withut running into a loop with an automation like this:

  - alias: 'AC_bedroom_controller'
    trigger:
      - platform: state
        entity_id: climate.bedroom_ac_control
      - platform: state
        entity_id: climate.air_conditioner_bedroom
    action:
      - service: climate.set_hvac_mode
        entity_id: climate.air_conditioner_bedroom
        data_template:
          hvac_mode: "{{ trigger.to_state.state }}"
      - service: climate.set_hvac_mode
        entity_id: climate.bedroom_ac_control
        data_template:
          hvac_mode: "{{ trigger.to_state.state }}"

I suspect the problem might be that your action is ordering both thermostats to do something when you really only need one of them to match what you just changed the other one to.
I have two separate automations, one for each thermostat.
Possibly you could try adding a delay of a few seconds to the action, that way it gives a little extra time for all the back and forth communication to happen.

Did you ever find a solution to your loop problem? I have noticed recently that occasionally I find my two thermostats target temps moving back and forth (same loop you are talking about I suspect). I’m testing a delay right now but since the problem doesn’t happen all the time I’m not sure how long it will take for the problem to happen again.

Hi @guy0nabuffalo

I solved this issue with a delay of one second.

my whole automation to sync both climates looks as follows:

# # Bedroom Thermostat


## HVAC Mode

  - alias: Thermostat - Set Slave HVAC Mode
    trigger:
      - platform: state
        entity_id: sensor.thermostat_bedroom_hvac_mode
    action:
      - delay: 
          seconds: 1
      - service: climate.set_hvac_mode
        data_template:
          entity_id: climate.air_conditioner_bedroom
          hvac_mode: "{{ trigger.to_state.state }}"

  - alias: Thermostat - Set Master HVAC Mode
    trigger:
      - platform: state
        entity_id: sensor.ac_bedroom_hvac_mode
    action:
      - delay: 
          seconds: 1
      - service: climate.set_hvac_mode
        data_template:
          entity_id: climate.bedroom_ac_control
          hvac_mode: "{{ trigger.to_state.state }}"


## Temperature

  - alias: Thermostat - Set Slave Temperatue
    trigger: 
      - platform: state 
        entity_id: sensor.thermostat_bedroom_temperature
    action:
      - delay:
          seconds: 1
      - service: climate.set_temperature
        data_template:
          entity_id: climate.air_conditioner_bedroom
          temperature: "{{ trigger.to_state.state }}"

  - alias: Thermostat - Set Slave Temperatue
    trigger: 
      - platform: state 
        entity_id: sensor.ac_bedroom_temperature
    action:
      - delay:
          seconds: 1
      - service: climate.set_temperature
        data_template:
          entity_id: climate.bedroom_ac_control
          temperature: "{{ trigger.to_state.state }}"

## Fan Mode

  - alias: Thermostat - Set Slave Fan Mode
    trigger: 
      - platform: state 
        entity_id: sensor.thermostat_bedroom_fan_mode
    action:
      - delay:
          seconds: 1
      - service: climate.set_fan_mode
        data_template:
          entity_id: climate.air_conditioner_bedroom
          fan_mode: "{{ trigger.to_state.state }}"

  - alias: Thermostat - Set Slave Fan Mode
    trigger: 
      - platform: state 
        entity_id: sensor.ac_bedroom_fan_mode
    action:
      - delay:
          seconds: 1
      - service: climate.set_fan_mode
        data_template:
          entity_id: climate.bedroom_ac_control
          fan_mode: "{{ trigger.to_state.state }}"
2 Likes