Wifi keeps saving preferences

Hi,
I’ve been playing with esphome for a while and I’ve noticed a bit strange and undesired behavior related to wifi component. When I add wifi component to to yaml file, then log file starts showing messages about saving preferences to flash.

[14:08:47][D][esp32.preferences:114]: Saving 1 preferences to flash…
[14:08:47][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed

One such message appears at boot, another one before entering deep sleep. Since lifetime of flash memory is limited, I’d like to prevent unnecessary writes to flash.

Is there a way how to prevent wifi from writing useless preferences to flash?

I’m using lolin32 lite board.

While that is true, I really wouldn’t worry about it. :slight_smile:

See my previous post here

Well seeing your config would probably help. Have you configured flash_write_interval or some other setting that frequently saves to flash?

I’ve already figured out, what’s causing the issue. It’s because of fast_connect: true in wifi configuration.

I’m using wifi with hidden SSID, therefore esp32 won’t connect to it without fast_connect at all. When looking at at source code of wifi component, I’ve noticed, that with fast_connect: true , wifi component starts saving bssid and channel to preferences.

This is IMHO undesired behavior, at least in cases the same as mine.

Considering how cheap esp boards are, I dont really consider it an issue. Replacing a 2$ esp board isnt exactly on the same level as replacing 2000$ devices. Its not realistic have high expectations for a 2$ MCU.