Actions on set value: Accessing the value of a changed Number Helper

I’m trying to capture my HVAC’s target temperature, save it in a Helper of type Template Sensor → Number and making sure that it stays updated with the actual target temperature of the climate component.
I almost got it to work. The number helper gets updated when the AC target temperature changes. But I am struggling to use the “Action on set value” option to udate the climate component whenever the number helper’s value is changed by a user.
E.g., if I set the value to 26, you can see that the tool tip indicates that I have set it to 26, but the actual value remains at 25:

Here is the implementation of the “Action on set value” in the helper:

The complete yaml code of that field is:

action: climate.set_temperature
metadata: {}
target:
  entity_id: climate.kitchen_ac
data:
  temperature: "{{ states('number.ac_target_temperature_kitchen') | float }}"

I assume I need to access a temporary variable that I just cannot find.

I used a similar approach in an select helper - and the action code there had to be:

action: climate.set_hvac_mode
data:
  hvac_mode: "{{ option }}"
metadata: {}
target:
  entity_id: climate.kitchen_ac

So, I had to use the {{ option }} variable to refer to the selected option.

What’s the equivalent in the number helper case? I tried {{ value }} and {{ number }}, but those don’t work.

Any help is appreciated. Thanks in advance!

{{ value }} is the one. What’s the value of your hvac_mode?

image

1 Like

Thanks for confirming that, @koying !

I had tried {{ value }} before … but I kept getting the following error message:

I now realise that the reason for that error message was that I tried to test the code using the “Run Action” menu - but that one wouldn’t have a value because I didn’t actually change the value immediately before running that action. :man_facepalming:

I very much appreciate the help!!