esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
411 stars 26 forks source link

Add `restore_mode` and default value to Number component #2088

Open arthurrump opened 1 year ago

arthurrump commented 1 year ago

Describe the problem you have/What new integration you would like

I would like to have a default value and restore-on-reboot system for the number component. I see this as similar to the restore_mode option of the switch component, but of course an additional property would be required to set the default numerical value for a number.

Please describe your use case for this integration and alternatives you've tried:

The concrete use case this came up with is in my OpenTherm external component. I expose a Number component which can be used to set, e.g. the target temperature for the central heating or domestic hot water circuits of a boiler. One user reported using this to set the domestic hot water temperature setpoint, but it resets the value when the ESP reboots. I think it makes sense to have a restore functionality similar to the Switch component at the ESPHome level, rather than in individual libraries.

A workaround to set a default value without restoring changes (like ALWAYS_ON/ALWAYS_OFF options in the Switch) could be created using the the number.set action and the on_boot event.

Additional context

nagyrobi commented 1 year ago

Template number offers restore_mode.