esp8266_web_settings beta
|
A generic device framework using the esp8266_web_settings library
This framework supports settings, control, and publishing of multiple ESP8266-attached devices in concert with the WebSettings
class from esp_web_settings, https://github.com/grmcdorman/esp8266_web_settings.
The base class for Devices is Device. The framework contains seven Devices:
The VindriktningAirQuality class is derived from work by Hypfer's GitHub project, https://github.com/Hypfer/esp8266-vindriktning-particle-sensor. All work on message deciphering comes from that project.
An additional helper class, ConfigFile, provides basic JSON configuration file loading and saving for the list of devices.
The sketch using the devices must have two strings, a firmware name, and a system identifier. The former is a static PROGMEM
string identifying the name or purpose of the sketch; the latter should be a unique name for the specific ESP device; typically this can be a derivative of the firmware name and the ESP chip ID, in hex.
In the sketch setup()
function, the following operations should be performed, in sequence, on the list of devices; this assumes you a global std::vector<Device *> devices
, a global configuration object ConfigFile config
, and a global WebSettings web_settings
.
In the sketch loop()
function, each device's loop()
method must be called:
Finally, in the on_save
callback from the WebSettings
class, the device configurations must be saved: