Input_number min/max with condition

Hi guys,
i am trying to get the “input_number” yaml to get working with the min/max values being conditioned on another sensor state (value). Example:

if value of x>0 then min=5

Could somebody tell me 1. if it’s possible, 2. how to write it correctly in yaml

Not possible. min and max do not accept templates, and they’re not attributes of the entity.

thanks for a quick reply! any idea/solution of building similarly working thing but letting to implement conditionals for lower/upper limits?

It might help if you explain your end use case. i.e. why do you want to change the input number min / max.

Simple case- i have a device that the regulation range depends on a mode that it operates on (heat pump working on a curve with -5/+5 range OR on a direct temp setting +5/50). So logic would be like

If mode=curve then
End if

You could create two input numbers and use the conditional card to display the correct one depending on the mode.

Likewise in your automations/scripts select the correct input number with a template depending on the mode.

Another option I can think of is to have one input number with the full range (-5 to 50) and limit its value with an automation. e.g. if someone changes the input number outside the range for the current mode move it back to the max/min.

Final option I can think of: you could have one input number (0-100%) and scale it depending on the mode when you use it in your automations/scripts.

Tom, the option of creating additional input number and conditional card would fit here perfectly! As automations and conditioning them are not the problem then this solution will solve my problem.

Marking as solution! Thanks!

1 Like