-
Notifications
You must be signed in to change notification settings - Fork 4
Description
In DHTPlugin.cpp , function loadConfig() fails due to a missing config file in SPIFFS.
What is the structure of dht.config that needs to be uploaded in SPIFFS?
DHTPlugin::DHTPlugin(uint8_t pin, uint8_t type) : _dht(pin, type), Plugin(2, 2) {
DEBUG_MSG("dht", "plugin started\n");
loadConfig();
_dht.begin();
DEBUG_MSG("dht", "_dht.begin()\n");
}
In Plugin.cpp, here is the loadConfig() function
bool Plugin::loadConfig() {
File configFile = SPIFFS.open("/" + getName() + ".config", "r");
if (configFile.size() == _size) {
DEBUG_MSG(getName().c_str(), "loading config\n", _size);
configFile.read((uint8_t*)_devices, _size);
}
else if (configFile.size() == 0)
DEBUG_MSG(getName().c_str(), "config not found\n", _size);
else
DEBUG_MSG(getName().c_str(), "config size mismatch\n", _size);
for (int8_t sensor = 0; sensor<getSensors(); sensor++)
if (strlen(_devices[sensor].uuid) != UUID_LENGTH)
_devices[sensor].uuid[0] = '\0';
configFile.close();
return true;
}