How to save manual changes to global variables being used in lambdas after REBOOT

Hi, i have a global variable “ihell_dsip” which is predefined in globals and can be changed. Code is:

  - id: ihell_disp     # Displayhelligkeit der Zeit
    type: int
    restore_value: yes
    initial_value: '80'

the way i can change this value manually is like:

number:
  - platform: template
    name: "input_hell_disp"
    id: input_hell_disp
    optimistic: true
    min_value: 70
    max_value: 128
    step: 2
    on_value:
      - globals.set:
          id: ihell_disp
          value: !lambda 'return x;'  # x is the value from the input number 

this all works fine,

BUT i want to keep the manually changed value AFTER REBOOT. I learned that in ESP8266 (which i am using) its needed to specify a pararameter in esp-section as follows:

esphome:
  name: wemos-01
  friendly_name: wemos-01
  platform: ESP8266
  board: d1_mini
  # ---------------------------------------------------------------------------
  esp8266_restore_from_flash: True

to restore the values. I did that…

But it always starts with the value 70.

I know that storing in EPROM is only every minute, so i waited long enough. But still no RESTORING.

Is there any more idea around ??

Hi, i found my mistake as:

number:
  - platform: template
    name: "input_hell_disp"
    id: input_hell_disp
    optimistic: true
    min_value: 70
    max_value: 128
    step: 2
    on_value:
      - globals.set:
          id: ihell_disp
          value: !lambda 'return x;'  # x is the value fr..

the restore must be declared in the number definfition block like:

  - platform: template
    name: "in_hell_disp"
    id: in_hell_disp
    restore_value: True
    optimistic: True
    min_value: 50
    max_value: 160
    step: 5
    on_value:
      - globals.set:
          id: ihell_disp
          value: !lambda 'return x;'  # x is the value from the input number
        # 

NOT in the globals section…
:grinning: