Use climate.set_temperature for another climate control

First of all thanks for all the helpful information in the forum. Has gotten me through the last few years. No I got a problem, I couldn’t find the solution for. I got the Netatmo Thermostats in the house. For one room the valvue for the heater is in another room. I bough now a Shelly TRV and added it to the mix. Thanks to the exellent description of halfcathttps://community.home-assistant.io/t/how-can-i-send-a-temperature-value-via-http-get-to-a-shelly-trv-radiator-thermostat/465744/3, I was able to use the other tempature sensor as a current temperature for the Shelly TRV. This all works fine.

Now I would like to use the same set_temperature as in other netatmo valves. I got how it should work, but need some help to extract the the set temperature. How can I use that temperature in the value row of the automation? Since it is not a sensor, I don’t get the hang of it.

 alias: Set tempature Essbereich
 description: Geiche Temperature im Essbereich wie im Wohnzimmer
 trigger:
   - platform: state
     entity_id:
       - climate.netatmo_living_room
     attribute: target_temp_step
 condition: []
 action:
   - service: climate.set_temperature
     data:
       value:        {{ (state_attr('climate.netatmo_living_room', 'target_temp_step') |float) | int }}
     target:
       entity_id: climate.shellytrv_14b457e5bdfa
 mode: single

A template placed on the same line as the option must have outer quotes. Because you have used single quotes inside the template, the outer quotes must be double-quotes.

Reference: Important Templating Rules

 action:
   - service: climate.set_temperature
     data:
       temperature: "{{ state_attr('climate.netatmo_living_room', 'target_temp_step') }}"
     target:
       entity_id: climate.shellytrv_14b457e5bdfa

In this case it’s not necessary to use a float or int filter because the attribute’s value is understood to be numeric. However, if you want to eliminate the numeric value’s decimal places then you can use round(0).


EDIT

Correction. Replaced value with temperature.
Reference: cover.set_temperature

1 Like

Are you sure you want to use the value of the target_temp_step attribute?

It doesn’t seem like the correct value to use for setting another thermostat’s setpoint temperature.

1 Like

Thanks for the quick replay and spot on. Yes, saw the little error as well, take the correct temperature and need to define what temperature to set. Working code below:

alias: Set tempature Essbereich
description: Geiche Temperature im Essbereich wie im Wohnzimmer
trigger:
  - platform: state
    entity_id:
      - climate.netatmo_living_room
    attribute: target_temp_step
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: >-
        {{ (state_attr('climate.netatmo_living_room', 'temperature') |float) |
        int }}
    target:
      entity_id: climate.shellytrv_14b457e5bdfa
mode: single

Glad to hear it works for you now.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

1 Like

Thanks for the help :slight_smile:

1 Like