Input_number initial config option help (input_number persistence after reboot)

Hi guys,

Trying to use a simple input_number to calculate some values but after every home assistant reboot the value gets reset to 0.

i first made the input_number in frontend (helpers -> input number) but noticed there is no option to set the “initial” option which is added to the input_number as default “null” when checking the input_number in developertools.

also made the same input_number in configuration file while leaving the option “initial” out because as the guide says it’s optional and when not used it defaults to the value before the reboot. well it still gets the option “initial: null” so the option “initial” is mandatory for input_numbers now?

anyway, which value due i need to set the option “initial” to to default to the last know value before the restart?

Which version of Home Assistant are you running? My input_numbers keep their state after a restart, initial: is not set. If you set initial it will get this value after a reatart.

most recent version, Home assistant 2020.12.2 stable with Home Assistant OS 5.9 stable.

this is my configuration file entry:

    name: energieverbruik_normaaltarief
    min: 0
    max: 10
    step: 0.01
    mode: box
    unit_of_measurement: €

these are the attributes of the input_number

Now when you change the input number and restart does the value go back to 0?

yes, it’s pretty weird :slight_smile:

i think its a bug or something, created input_text and input_datetime which don’t get the initial: null added. see screenshot.

Any solution to this?
I am trying, as well, to use input_number for storing the current electricity kWh cost , and use it in a template sensor for calculation of the dayly/weekly/monthly energy cost…
I thought I could utilize the input_number to hold the current kWh-cost, and update whenever the cost changes…

Are you saying that you are seeing resets on HA restart, or are you just concerned having read about this issue?

I have several input_numbers that do not reset on restart. This one, for example:

For me it resets every time I restart HA!

Before restart:

There is a value for the input number. And my template sensor actually uses the value for calculation of the energy cost!

After restart:

There are no longer a value…

What version of HA are you running, and how did you create the input_number? The lack of attributes suggests to me that you’ve probably used YAML — perhaps try recreating via the UI instead, or adding the same attributes as mine.


It is defined in UI!

However, looking at the helpers page in UI, I see it is not editable…