#Using a template for Lower target temperature in climate automation

1 messages · Page 1 of 1 (latest)

median loom
#

TLDR: I'm trying to create an automation that will increase my Ventstar thermostat by 2 degrees if the heat pump that it controls has been running for 15 minutes, then wait for 30 seconds and then decrease the setpoint back by 2 degress to the original setpoint. When I try to use a template to perform the increase task, it will not pass the error check. I assume this is because either a template can not be used or I'm structuring the action incorrectly.

For some reference, the Ventstar thermostat has a feature that is "supposed" to work but does not. If the temperature is too cold, a heat pump can't efficiently extract heat from cold air (near or below 30°F) so the way the thermostat is again, "supposed" to work is after a set time (15 mins), if the setpoint hasn't been reached yet, the aux heat is supposed to turn on to assist. The Home Assistant Ventstar integration doesn't have access to the aux heat mode and, as inferred by the word "supposed", the thermostat does not activate aux heat after 15 minutes so the heat pump just continues to run while trying to do its job. If, however, I bump up the setpoint by two degrees, it will activate aux heat and do what I want it to do....hence my question.

Can someone offer any suggestion as to what I can't do or what I might be doing wrong....or another way to accomplish this?

sharp prism
#

I think you need to put the full template in the quotes, no?

#
action: climate.set_temperature
target:
  entity_id: climate.main
data:
  temperature: "{{ state_attr('climate.main', 'target_temp_low') | float + 2 }}"

Or, what I prefer, in a new line:

action: climate.set_temperature
target:
  entity_id: climate.main
data:
  temperature: >
    {{ state_attr('climate.main', 'target_temp_low') | float(10) + 2 }}

Notice that in the second example I also added the default value in the float(xx) function to prevent error if attribute holds wrong value, for example.

#

For example, you may receive this error if the attribute doesn't exists or is not a number:

Failed to perform the action climate.set_temperature. Error rendering data template: ValueError: Template error: float got invalid input 'None' when rendering template '{{ state_attr('climate.ac_hallway', 'target_temp_low') | float + 2 }}' but no default was specified

In my case the climate entity doesn't have the target_temp_low, thus I get an error

median loom
#

Still getting an error...

#

The greater than symbol was changed to the pipe symbol by Home Assistant. I did try it the other way to....by removing the next line indicator and placing the template one space after the colon for temperature. I also tried template instead of temperature....same outcome.

sharp prism
#

there seems to be some other error

#

can you try to run the action in developer tools -> actions

#

it may throw you an error directly

median loom
#

This felt way harder than it needed to be..... 😆

But this works now....

action: climate.set_temperature
target:
entity_id: climate.main
data_template:
entity_id: climate.main
target_temp_high: "{{ state_attr('climate.main', 'target_temp_high') | int + 2 }}"
target_temp_low: "{{ state_attr('climate.main', 'target_temp_low') | int + 2 }}"
hvac_mode: auto # Necessary for target_temp_low/high

#

For clarity....the target: and its entity_id lines are not required.

#

Further refinement...

The | int part is not necessary either....

sharp prism
#

yes, the | is not needed because you put the template in the quotes, which is what I very originally said 🙂

tight swan
#

data_template has been deprecated like 6 years ago , you can just use data

tight swan