ESPHome's globals component is getting the storage option that other components already use to choose where a restored value is saved. With storage: rtc, a global lives in RTC memory, which survives deep sleep, software restarts and crashes, and a value that changes every few minutes no longer means a flash write every few minutes. Pull request #13954 by Rapsssito, opened in February, was merged into the development branch by bdraco on 18 October 2026 at 22:40 Polish time, with its documentation (esphome.io #6068) a few seconds later. ESPHome 2026.10 is still in beta, so the option is set for ESPHome 2026.11.

globals:
  - id: wake_count
    type: int
    restore_value: true
    storage: rtc
    initial_value: '0'

Flash or RTC memory

storage only works together with restore_value: true. The documentation describes the two choices this way:

  • flash survives a power cut, but every save wears the flash a little, so it suits values that change rarely;
  • rtc survives software restarts, crashes and deep sleep, but not a power loss, and it avoids flash wear, so it suits values that change often. On the original ESP32 the hardware reset button (the EN pin) clears it too.

A wake-up counter on a battery sensor that spends most of its time in deep sleep is the obvious case for rtc. A value that has to outlast a power cut does not belong there. The rolling code for Somfy RTS blinds is one example: each command needs a higher code than the last one, so if the counter falls back to an old value, the receiver ignores the commands.

Any type works, including std::string and arrays, because the value goes through the same preferences mechanism the other components use. The first version of the pull request only handled simple types and added a separate restore_value: RTC mode, which the merged version replaces with storage.

Defaults and supported chips

If you leave storage out, nothing changes, and the generated code is the same as before. On the ESP32 that means flash. On the ESP8266 it means RTC memory, unless restore_from_flash: true is set on the ESP8266 platform.

rtc is accepted on the ESP32 except the C2 and C61 variants, which have no RTC memory, on the ESP8266, and on the Beken BK7231T, BK7231N and BK7238. Those Beken chips have no RTC memory either. Since a change merged earlier the same day, rtc on them keeps the value in flash and forgets it after a power cut, so it does not save any wear. On other platforms, such as the RP2040, only flash is accepted.

The ESP8266 has only 96 bytes of RTC memory for all restored values together. Restored std::string globals now count toward that limit at build time, so a configuration that does not fit stops with an error during compilation instead of failing to save on the device. This check applies whether or not you use the new option.

The author tested the change on an ESP32 with the ESP-IDF framework.