Application configuration file
Posted: Fri Apr 01, 2022 6:57 pm
One of the requirements for a project I am working on is to be able to work with configuration file - the user should be able to upload a JSON or YAML file to the ESP32, which would then parse it and configure its application with details such as:
- IP address
- MQTT broker
- MQTT topics to publish/subscribe to
- Sensor polling interval
- Modbus registers to read and so on
Browsing through the examples, it looks like the simple ESP32 file server is a good starting point. The config files will be relatively large - a few KB. I'd like some advise on how to store them - NVS, SPIFSS, or external storage? Also, my initial idea is to read the complete file on boot, parse it and keep it in RAM for the duration of the application run. If any of the parameters change (MQTT will allow pushing parameters into the device), the RAM buffer will be written back to non-volatile storage.
Further, the device is supposed to support OTA, therefore what would be advisable - to keep the config file as a part of the compiled application, or keep it on separate storage, like SD card?
Thanks and hope my questions make sense.
- IP address
- MQTT broker
- MQTT topics to publish/subscribe to
- Sensor polling interval
- Modbus registers to read and so on
Browsing through the examples, it looks like the simple ESP32 file server is a good starting point. The config files will be relatively large - a few KB. I'd like some advise on how to store them - NVS, SPIFSS, or external storage? Also, my initial idea is to read the complete file on boot, parse it and keep it in RAM for the duration of the application run. If any of the parameters change (MQTT will allow pushing parameters into the device), the RAM buffer will be written back to non-volatile storage.
Further, the device is supposed to support OTA, therefore what would be advisable - to keep the config file as a part of the compiled application, or keep it on separate storage, like SD card?
Thanks and hope my questions make sense.