Lambda delay restore after reboot

hello,
it’s possible save lambda delay after reboot or power off?

I try to add the parameter “restore_value” but doesn’t save anything after reboot or power off

switch:
  - platform: gpio
    id: relay1
    name: "Basculante"
    pin: P14
    icon: "mdi:garage"
    on_turn_on:
    - delay: !lambda return (id(TDLB).state);
    - switch.turn_off: relay1
number:
  - platform: template
    name: "TDL Basculante"
    id: TDLB
    optimistic: true
    min_value: 250
    max_value: 10000
    step: 250
    mode: slider
    restore_value: true
 

You can try with a global, use an on_value trigger under the number to mirror the number value and use the global in the lambda.

https://esphome.io/guides/automations#global-variables

Edit you can set the logger to VERBOSE and you should see what is going on, my thought is that the number loads after.

https://esphome.io/components/logger#logger-manual-tag-specific-levels

For esp8266 platfoem check this setting:

  • restore_from_flash (Optional, boolean): Whether to store some persistent preferences in flash memory. Defaults to false.

IMHO it required ro save number value.

Thanks for trick