Number input that supports entry of a number with 2 decimal places

I am trying to set up a Number Helper that will allow me to enter a floating point number with 2 decimal places manually using a keyboard. I have created the helper with step size of 0.01 and set it to an input field. When editing the number in lovelace, however, the input field will not allow me to type either ‘.’ or ‘,’ for the decimal point so I cannot enter the decimal point values. Is this a bug in the field control, as I can use the up/down arrows to increment or decrement the entered value by the 0.01 step value?

All I am after is a simple textbox that allows me to enter this value. Are there any custom controls that I could use?

Can’t you use an input_text then?

I need to use the value entered in a template calculation. I did try using a text field, but the calculation always converted the digit text entered as 0.

I can’t replicate that.
Feel free to post what you calculations you did.

What lovelace card are you using? When using an Entities card I can enter .0x (where x is any non-zero digit) . If I try to use an Entity card, it opens up a more info popup that has issues with .0x, it’s fine with any non-zero digit i.e. .xx

Thanks for your help on this. We have a pre-paid power meter. I am trying to set up a display that shows how much power we have left. I have a Home Assistant Glow sensor that gives me the current power used by the house as an incrementing number (in Kwh). I have a Client Interface Unit that shows the amount of power left for the meter (There is no way to easily interface with this unit)

I have 2 number helpers, PrepaidStart and PowerStart. When I enter a number in PrepaidStart I have an automation that copies the current power value into the PowerStart number. The amount of power left is provided for by a template sensor as follows.

friendly_name: Prepaid Current
value_template: “{{ states(‘input_number.prepaidstart’)|float - (states(‘sensor.power_total’)|float - states(‘input_number.powerstart’)|float) }}”

This all works OK apart from the fact that I cannot enter a 2 decimal place number for PrepaidStart in lovelace.

As mentioned I would use a input_text for that in a template sensor.

1 Like