How to restore data from homeassistant to ESPHome on boot or wake up

In my project I have a number used in ESPhome and this numer is input in HA.
ESPHome sometimes disconnects or goes to sleep, but during that period the number in HA may change.
I know that I can manually create a Helper in HA, which ESP will use, but I do not want to create anything manually.
Is there any possibility to restore the changed number from HA OR maybe automatically create a helper in HA when I add ESPHome device to HA.

I hope that my idea is clear.