Flexible climate groups

I have two adjacent rooms with electric floor heating controlled by heatit thermostats. One is an office and the other a tv/guest room.

I want to be able to treat them as a single climate group when the door between them is open, and as separate rooms when the door is closed. Ideally I would also like the target temperature to update to both rooms if the door is open and someone operates the heatit thermostats locally. Any suggestions on how to go about this?

Think something like this should work:

alias: Livingroom / Office Link climate temperature
description: ''
mode: single
trigger:
  - platform: state
    entity_id: climate.livingroom
    id: livingroom
    attribute: temperature
  - platform: state
    entity_id: climate.office
    id: office
    attribute: temperature
  - platform: state
    entity_id: binary_sensor.door
    to: 'on'
condition:
  - condition: state
    entity_id: binary_sensor.door
    state: 'on'
  - condition: template
    value_template: >-
      {{ state_attr('climate.livingroom', 'temperature')|float !=
      state_attr('climate.office', 'temperature')|float }}
action:
  - choose:
      - conditions:
          - condition: trigger
            id: office
        sequence:
          - service: climate.set_temperature
            target:
              entity_id: climate.livingroom
            data:
              temperature: '{{ state_attr(''climate.office'', ''temperature'')|float }}'
    default:
      - service: climate.set_temperature
        target:
          entity_id: climate.office
        data:
          temperature: '{{ state_attr(''climate.livingroom'', ''temperature'')|float }}'

I also made it that the office temperature is set to the living room temperature when the door is opened. If you don’t want that to happen you can remove the door sensor from the triggers. You could also add a for to the trigger if you only want it to happen after some time. This might be useful if you only walk in the office to grab something and leave again.

1 Like

Cool. That was really quick! Thank you!
I’ll give it a go and let you know how it went. Would you be able to talk me through what the code here is doing? I’m not quite seeing it. I’m pretty new to homeassistant and especcially yaml. I mostly use node red because i find the troubleshooting there easier.


alias: Livingroom / Office Link climate temperature
description: ''
mode: single
trigger:
  - platform: state
    entity_id: climate.livingroom
    id: livingroom
    attribute: temperature
  - platform: state
    entity_id: climate.office
    id: office
    attribute: temperature

As triggers I simply use the change of the temperature attribute of the climate elements of the office and living room. To know which once changed an thus triggered I use the new triggerId feature.

  - platform: state
    entity_id: binary_sensor.door
    to: 'on'

I also added the door opening as a trigger so it would link the temperature when you enter. I assign it the same triggerId as changing the living room thermostat so it will cause the same action (aka, set the office temperature).

condition:
  - condition: state
    entity_id: binary_sensor.door
    state: 'on'

This will make the automation only work when the door is open.

  - condition: template
    value_template: >-
      {{ state_attr('climate.livingroom', 'temperature')|float !=
      state_attr('climate.office', 'temperature')|float }}

And only if the office and living room are set to different temperatures.

action:
  - choose:
      - conditions:
          - condition: trigger
            id: office
        sequence:

Now I start a chooser which will pick one set of actions depending on a set of conditions. For this set op actions the condition is that the automations was triggered by a trigger with triggerId office. Looking at the trigggers, that is the changing of the climate object for the office.

          - service: climate.set_temperature
            target:
              entity_id: climate.livingroom
            data:
              temperature: '{{ state_attr(''climate.office'', ''temperature'')|float }}'

If that was the case I call the service to set the temperature of the living room. As a value I grab the temperature of the office.

    default:
      - service: climate.set_temperature
        target:
          entity_id: climate.office
        data:
          temperature: '{{ state_attr(''climate.livingroom'', ''temperature'')|float }}'

If the above condition wasn’t met (aka, the automation was not triggered by a trigger with triggerIf office => it was triggered by a trigger with triggerId livingroom = or livingroom temperature was changed or the door opened just now) it will perform the default aaction which is doing the opposite. So now the office temperature is set to the temperature of the livingroom.

I use the default case so the triggerIf livingroom isn’t really used / nessacairy but makes things a bit more clear. By using the default rather than making a simmalar case for the livingroom-trigger as well will cause it to set the office temperature to the living room temperature if you manually run this automation.

1 Like

That was very helpful! Thanks again. I had not looked into trigger iIDs beyond the fact that i had heard of them on the home assistant podcast. Seems super useful. Looking forward to playing more with them. I’ll get this set up and get back to you. Probably not until later because for some reason me playing with door sensors does not count as weekend family fun time:-)

So this is extremly late feedback, but I couldn’t get things to work at first, and then life moved on. I picked it back up again today, now with a bit more HA experience, and the solution works. I’ll look into adding a bit of a delay, maybe through a helper? so that it doesn’t turn up the heat in the office when I go in to get my charger or something. Thank you again for your help.