How can I save custom data to persistent storage?
Use ESP-IDF's NVS (Non-Volatile Storage) for saving custom data:
#include "nvs_flash.h"
#include "nvs.h"
// Write data
nvs_handle_t handle;
nvs_open("storage", NVS_READWRITE, &handle);
nvs_set_i32(handle, "key", value);
nvs_commit(handle);
nvs_close(handle);
// Read data
int32_t value;
nvs_open("storage", NVS_READONLY, &handle);
nvs_get_i32(handle, "key", &value);
nvs_close(handle);
ESP RainMaker also provides convenient wrappers for storing node information automatically.