Seeking help with Yaml automation (data_template)

Hi

I am unable to get this working. The template renders well but the service call does not.

action: 
    service: climate.set_temperature
    data_template: 
      entity_id: climate.bedroom_ac
      hvac_mode: "cool"
      temperature: {{states('sensor.bedroom_avg_temp') |int + 2}}
      target_temp_high: {{states('sensor.bedroom_avg_temp') |int + 4}}
      target_temp_low: {{ states('sensor.bedroom_avg_temp')}}

image

What am I doing wrong? Any tips will be quite helpful. Struggling with it since last evening. Please help

Put quotation marks around your templates

Ignore the funky indentations, I’m on my phone :roll_eyes:

1 Like

Thanks @jivesinger . I did try this in one of the iterations but I get the following error when I call the service from developers tab. It validates the Configuration though.

climate.set_temperature

Failed to call service climate/set_temperature. must contain at least one of temperature, target_temp_high, target_temp_low.

The answer to your problem may be here…

You may have to break down your action in to several service calls.

Fair point… I broke the service call and just gave the temperature with the template (also removed hvac_mode). Still the service refuses to be called.
Maybe data_template does not work with this service.