How to copy values from one entity to another

Hi, I have 2 thermostatic valve in one room (Eurotronics Sprint, zwave) and I want to syncrozies them, meaning, if I change manually valve1 that the settemp is sent to valve2. It is possible to set a value via script but not the value from an anther on?

alias: Testscript
sequence:
  - service: climate.set_temperature
    entity_id: climate.thermostat_valve_2
    data_template:
      temperature: 20
mode: single

works perfectly, but here

alias: Testscript
sequence:
  - service: climate.set_temperature
    entity_id: climate.thermostat_valve_2
    data_template:
      temperature: {{ state_attr("climate.thermostatic_valve","temperature") }}
mode: single

the value of the attribute is not recognized / empty. The template works fine in dev.-tool / template. Any hint?

Maybe this is a string and then you need to the int filter:

{{ state_attr(ā€œclimate.thermostatic_valveā€,ā€œtemperatureā€) | int }}

You can try it in the developer tools, there is a section to develop templates

Wrap it with quotes:

temperature: "{{ state_attr('climate.thermostatic_valve', 'temperature') }}"

Edit: Corrected wrong quotes

Thank you for tip, but unfortunately no change. Both things I tested in develop templeates. It seems to me, that this expression is ignored. If I would test it in script editor, the expression will be changed to {} :frowning:

{{ state_attr('climate.thermostatic_valve', 'temperature') }}

What is the result of the above in Dev Tools? If it is ā€žnoneā€œ, it is not an attribute. Check it under Dev Tools ā†’ States

The result is the desired set temperture:

So the value looks correct now but itā€™s still not working to set it to valve_2 ?

No, unfortunately not: ā€œError rendering data template: Result is not a Dictionaryā€

This works for me: (and note the different quotes)


service: climate.set_temperature
target:
  entity_id: climate.ir_heizung_wz
data:
  temperature: "{{ state_attr('climate.ir_heizung_sz', 'temperature') |float}}"

Thank you, thatā€™s it! I did in this way and it works now:

Bild1