Parameter in script - syntax probem

Hello everybody,

Sorry in advance for my English, here is my problem :
I have some netatmo thermostats, to avoid having many scripts,I would like pass name of the thermostat in a parameter (thermostat1, thermostat2, etc.) for a script like that :

alias: netatmo_increment_consigne
sequence:
service: climate.set_temperature
data_template:
temperature: {(states.sensor.netatmo_{thermostat_name}_temperature_consigne.state | float + 0.5)}}
target:
entity_id: climate.{{thermostat_name}}
mode: single

result is ok for “entity_id:” line:
* entity_id: climate.thermostat1

for “temperature” line, I don’t know how procced.for obtain that :
*temperature: {(states.sensor.netatmo_thermostat1_temperature_consigne.state | float + 0.5)}}

Someone can help me ?

thanks a lot

alias: netatmo_increment_consigne
sequence:
  - service: climate.set_temperature
    data:
      temperature: "{{ states('sensor.netatmo_' ~ thermostat_name ~ '_temperature_consigne') | float(20) + 0.5 }}"
    target:
      entity_id: 'climate.{{thermostat_name}}'
mode: single
1 Like

Wonderful, exactly what I needed.
Thank you very much for your quick response

1 Like