Getting errors setting thermostat target temp through slider

Hi,

I’m trying to control my thermostats’ target temperatures through some sliders and an automation that triggers when the sliders are moved:

alias: 'Heating, Day'
trigger:
  - platform: time
    hours: 08
    minutes: 00
    seconds: 00
  - platform: state
    entity_id: input_slider.heating_livingroom_day
  - platform: state
    entity_id: input_slider.heating_bedroom_day
  - platform: state
    entity_id: input_slider.heating_office_day
condition:
  condition: template
  value_template: '{{ 8 <= now().hour < 16 }}'
action:
  - service: climate.set_temperature
    data:
      entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_4
      temperature: '{{ states.input_slider.heating_livingroom_day.state }}'
  - service: climate.set_temperature
    data:
      entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_3
      temperature: '{{ states.input_slider.heating_bedroom_day.state }}'
  - service: climate.set_temperature
    data:
      entity_id: climate.danfoss_z_thermostat_014g0013_heating_1_2
      temperature: '{{ states.input_slider.heating_office_day.state }}'

When this triggers, I get the following error:

homeassistant.core: Invalid service data for climate.set_temperature: expected float for dictionary value @ data['temperature']. Got '{{ states.input_slider.heating_livingroom_day.state }}'
(also for the other thermostats)

It appears the template is not evaluated. But why?
What else can I do to set the temperature based on a slider value?

TIA,
Sebastian

Ok, found it…
Apparently one has to use data_template: instead of data: for the climate control.

I have also added a notification service (not shown in my example) where the template evaluates fine inside a data: section. Strange.

Sebastian

2 Likes