Can you reset a number_input to its original default value?

I have a number_input which has a default value, and can be changed as required through the UI.
At a predetermined time, in this case when another entity’s value reaches this input_numbers value, I want the input_number to just reset to it’s default, whatever that is stored in the config file.

I’ve tried using a number_reload, but that appears to have no effect on it’s current value and is unchanged. So below, the range can be changed via the UI, I want this sensor to reset to its default - 110 - when an entity matches.

Stuck!

input_number:
  maxdailyrange:
    name: maxdailyrange
    initial: 110
    min: 1
    max: 350
    step: 1

You can use:

service: input_number.reload
data: {}

However be aware (if you are not already) that the above service will reload all input_number entities that have an ‘initial value’ set, also all input_number entities with ‘initial value’ set will also revert to this value when restarting HA.

You could of course (if you want to avoid reload / reset) always set the automation / script to input the 110.

service: input_number.set_value
data:
  value: 110
target:
  entity_id: input_number.your_input_number

I tried

service: input_number.reload
data: {}

The value though stayed unchanged as I have that number entity showing in the dashboard for debugging. The 110 value is what I’m using here, but I want to share this code out with others so they will have their own value, hence just trying to revert to the default.

OK, having just checked it for myself, it seems the documentation is incorrect or there is an issue.

The documents state:

initial float (optional, default: The value at shutdown)
Initial value when Home Assistant starts.

And:

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.

So in theory I read that, if restarting HA and/or reloading ‘input_number’ any ‘input_number’ with an ‘initial’ value set should reload back to that initial number.

However

reload - Reload input_number configuration

Or reloading ‘input numbers’ via developer tools - appears to have no effect at all. The only time it seems to revert back to ‘initial’ value is restarting HA.

You could of course have the value be set via whatever automation / script you are using or planning to use via the above example or use the following

service: input_number.set_value
data:
  value: "{{ state_attr('input_number.your_input_number', 'initial') | float(0) }}"
target:
  entity_id: input_number.your_input_number

That’s what I found. Restarting HA means that number reverts to its initial value, which is fine. What doesn’t happen is a reset to that initial value on the numberreload action.

Perhaps a workaround is specify two numbers values, with the second one having the same initial value, and populating the first with the second, that second number being the control number.

So this works, although a little clunky

In configuration.yaml:

input_number:
  maxdailyrange:
    name: maxdailyrange
    initial: 110
    min: 1
    max: 350
    step: 1
  maxdailyrangecontrol:
    name: maxdailyrangecontrol
    initial: 110
    min: 1
    max: 350
    step: 1
alias: Number Reload Test
description: ""
trigger: []
condition: []
action:
  - service: input_number.set_value
    data:
      value: "{{ states('input_number.maxdailyrangecontrol') | float(0) }}"
    target:
      entity_id: input_number.maxdailyrange
mode: single