When I change “just_input_number”, then “number_test” is updated but the action to set the value of “just_output_number” is never executed. I thought I had followed the example here exactly (it looks like it is trying to do similar, ie update another number) , but it still doesn’t work as expected.
No messages in the logs that I can find either. My actual example is a little different as I am trying to set a timer on a heater based on the difference between setpoint and actual temperature, but this is a simpler example that still wont work for me.
Normally, your action in set_value would be targeted at just_input_number… otherwise the state of number_test will never match the values you set it to.
That is the expected behavior. The actions in set_value are only triggered when number_test itself is changed.
Are you sure you even want a template number? They have a very niche use case. Perhaps a trigger-based template sensor with an actions section is what you really need.
If you’re not sure, describe your use case in more detail and we can help. Your brief description just sounded like you needed an automation.
I tried template number because it cuts down on having to have a template and an automation to adjust my heater.
The use case is:
Bathroom heated by
electric towel rail with zwave switch
underfloor heating with zwave room thermostat
the towel rail (160W) by itself is usually enough to keep the bathroom above 23C so the floor never gets warm ! (
When the bathroom floor is heating, the PWM value (https://github.com/domectrl/ha-slow_pwm) is adjusted in proportion to the difference between setpoint and room temperature to give some power to the towel rail
I have already solved this with an input_number and an automation, but it should have worked with the number template.
The entity used in the state template is not the input, it is the storage place. The input is the number entity which is created by the configuration. Only script or dashboard actions targeted at number.number_test will trigger the action sequence configured under set_value… So the value of entity used in the state template must be updated within set_value to remain accurate.
My expectation is that any changes to towel_test will trigger a call to set_value and changes to just_input_number will as such trigger a change to just_output_number
What happens is:
changes to just_input_number currently updates towel_test but not just_output_number
changes to towel_test using the slider currently updates just_output_number
If this behaviour is “by design” then there is not much point surely?
That does not make sense, I cant see that it is useful as you can just do the same with a regular automation. As I understand the documentation, a change in state should trigger set_value?
“This example demonstrates the usage of a template number with a unit of measurement set to change a unit-less value of another number entity.”
So when the cutting height changes their automower_cutting_height_raw gets changed
In the referenced example, the change in state of number.automower_cutting_height_raw will change the current value shown as the state of number.automower_cutting_height, but it will not trigger set_value… and it doesn’t need to because the target of the action is already at the desired height.
Yes, when number.automower_cutting_height is changed by script or dashboard action, the action sequence of set_value will run and the value of the targeted entity number.automower_cutting_height_raw will be changed.