Climate service set temperature value to template

Hi all,

I have a room with 3 heater. I’m trying set the target temperature of all heater, if 1 changed. I try the following:

alias: Wohnzimmer Heizung - change 1 set all
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.stubegr_heizung_garten_5
    attribute: temperature
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: ID_StubeGr-Heizung-Garten_C1Sa
  - platform: state
    entity_id:
      - climate.stubegr_heizung_strase_4
    attribute: temperature
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: ID_StubeGr-Heizung-Strase_C1Sa
  - platform: state
    entity_id:
      - climate.stubekl_heizung_6
    attribute: temperature
    for:
      hours: 0
      minutes: 0
      seconds: 5
    id: ID_StubeKl-Heizung_C1Sa
condition: []
action:
  - if:
      - condition: trigger
        id: ID_StubeGr-Heizung-Garten_C1Sa
    then:
      - service: climate.set_temperature
        data:
          temperature: "{{ state_attr('climate.stubegr_heizung_garten_5', 'temperature') }}"
        target:
          device_id:
            - 99548e3d8dc60fc802ee8a119681648d
            - 41a59e42ea18f4f320ee5b3740fb332a
  - if:
      - condition: trigger
        id: ID_StubeGr-Heizung-Strase_C1Sa
    then:
      - service: climate.set_temperature
        data:
          temperature: "{{ state_attr('climate.stubegr_heizung_strase_4', 'temperature') }}"
        target:
          device_id:
            - 41a59e42ea18f4f320ee5b3740fb332a
            - 8fd8e1a2ad9ea7bc58a10ea19148dd51
  - if:
      - condition: trigger
        id: ID_StubeKl-Heizung_C1Sa
    then:
      - service: climate.set_temperature
        data:
          temperature: "{{ state_attr('climate.stubekl_heizung_6', 'temperature') }}"
        target:
          device_id:
            - 99548e3d8dc60fc802ee8a119681648d
            - 8fd8e1a2ad9ea7bc58a10ea19148dd51
mode: single

But the part of data, I try to set

temperature: “{{ state_attr(‘climate.stubekl_heizung_6’, ‘temperature’) }}”

is not working. Looks like only numbers allowed there. Any Idea how I can collect the changed attribut and set them to all heater?

Try this version:

alias: Wohnzimmer Heizung - change 1 set all
description: ""
trigger:
  - platform: state
    entity_id:
      - climate.stubegr_heizung_garten_5
      - climate.stubegr_heizung_strase_4
      - climate.stubekl_heizung_6
    attribute: temperature
    for:
      seconds: 5
condition: []
action:
  - variables:
      thermostats:
        - climate.stubegr_heizung_garten_5
        - climate.stubegr_heizung_strase_4
        - climate.stubekl_heizung_6
  - service: climate.set_temperature
    data:
      temperature: "{{ trigger.to_state.attributes.temperature }}"
    target:
      entity_id: "{{ thermostats | reject('eq', trigger.entity_id) | list }}"
mode: single
max_exceeded: silent

Cool, this works perfect. Many thanks.

1 Like