Input number reset

Good morning I would need some help if possible. I have two Number inputs that update every sunset and every sunrise respectively. I would just like these Number inputs to remain fixed for the entire period even after any home assistant restarts (and therefore until the next sunset and until the next sunrise). I’m freaking out but I can’t do that. Does anyone have any idea how to do this? I’ve tried the “recorder”, a status sensor, various automations, etc. but all to no avail. Thanks to those who will be able to help me

I fail to understand the problem. Input numbers retain their value on restart. They will go unavailable for a short while during restart, but that is unavoidable for any sensor during restarts.

Could it be you are using them with | float(0) in templates, and that is why you think that they reset? Because that means: use 0 when they are not available. In that case an availability template will help.

If you define them with an initial value, they will reset to the initial value on startup. Remove the initial value and they will restore to the last value.

isn’t that what you’ve described as a requirement. it will retain its value until it has changed, even with a restart?

So instead of zero in the initial value I have to leave it blank? Anyway I tried and the system gives me configuration error.

No, I have sensors that define measurements as the difference between the value recorded by the Number input and the daily consumption, which will be different. You understand that if at the restart this input Number updates to zero instead of remaining at the value recorded at the end of the period, it is a problem and the wrong measurement. That’s why I need these Number inputs to return the last recorded value even with subsequent reboots.

Remove the entire line. Post the yaml.

It doesn’t if there is no initial value, so remove that entire line if you defined it in yaml. If not, the answer is in where you use it. As said, post that template.

From the docs:

If you set a valid value for initial this integration will start with the state set to that value. Otherwise, it will restore the state it had prior to Home Assistant stopping. Please note that initial is only available in a YAML configuration and not via the Home Assistant user interface.

It worked. Thank you very much.:blush::blush: