I can’t find any info about writing / reading from ESP32 NVS in ESPhome, can someone help on this?
Well you can’t write straight to it with ESPHome but when you create some permanent variables they’ll be written in it
Why do you want to get access at NVS as such ?
Have a read about Global Variables.
- restore_value (Optional, boolean): Whether to try to restore the state on boot up. Be careful: on the ESP8266, you only have a total of 96 bytes available for this! Defaults to
no
. This will use storage in “RTC memory”, so it won’t survive a power-cycle unless you use theesp8266_restore_from_flash
option to save to flash. See esp8266_restore_from_flash for details.
On the ESP32 they just work.
Check out the Preferences
library, which is part of the arduino-esp32 framework (part of standard esphome install). I don’t think it has a yaml interface, but its c++ API is easy to use. It stores key-value pairs to NVS.
There is also the esp32/preferences library, which I think is what esphome uses under the hood to store data across reboots. I have not worked directly with this yet.