sht: replace _enabled by "enabled"
... so the usermod status shows correctly in UM overview.
This commit is contained in:
@@ -47,7 +47,7 @@ class ShtUsermod : public Usermod
|
|||||||
ShtUsermod(const char *name, bool enabled):Usermod(name, enabled) {} //WLEDMM
|
ShtUsermod(const char *name, bool enabled):Usermod(name, enabled) {} //WLEDMM
|
||||||
// Strings to reduce flash memory usage (used more than twice)
|
// Strings to reduce flash memory usage (used more than twice)
|
||||||
//static const char _name[]; //WLEDMM use public attribute of class UserMod
|
//static const char _name[]; //WLEDMM use public attribute of class UserMod
|
||||||
static const char _enabled[];
|
//static const char _enabled[]; //WLEDMM not needed
|
||||||
static const char _shtType[];
|
static const char _shtType[];
|
||||||
static const char _unitOfTemp[];
|
static const char _unitOfTemp[];
|
||||||
static const char _haMqttDiscovery[];
|
static const char _haMqttDiscovery[];
|
||||||
@@ -73,7 +73,7 @@ class ShtUsermod : public Usermod
|
|||||||
|
|
||||||
// Strings to reduce flash memory usage (used more than twice)
|
// Strings to reduce flash memory usage (used more than twice)
|
||||||
//const char ShtUsermod::_name[] PROGMEM = "SHT-Sensor"; //WLEDMM use public attribute of class UserMod
|
//const char ShtUsermod::_name[] PROGMEM = "SHT-Sensor"; //WLEDMM use public attribute of class UserMod
|
||||||
const char ShtUsermod::_enabled[] PROGMEM = "Enabled";
|
//const char ShtUsermod::_enabled[] PROGMEM = "Enabled"; //WLEDMM not needed
|
||||||
const char ShtUsermod::_shtType[] PROGMEM = "SHT-Type";
|
const char ShtUsermod::_shtType[] PROGMEM = "SHT-Type";
|
||||||
const char ShtUsermod::_unitOfTemp[] PROGMEM = "Unit";
|
const char ShtUsermod::_unitOfTemp[] PROGMEM = "Unit";
|
||||||
const char ShtUsermod::_haMqttDiscovery[] PROGMEM = "Add-To-HA-MQTT-Discovery";
|
const char ShtUsermod::_haMqttDiscovery[] PROGMEM = "Add-To-HA-MQTT-Discovery";
|
||||||
@@ -390,7 +390,7 @@ void ShtUsermod::addToConfig(JsonObject &root)
|
|||||||
{
|
{
|
||||||
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
|
JsonObject top = root.createNestedObject(FPSTR(_name)); // usermodname
|
||||||
|
|
||||||
top[FPSTR(_enabled)] = enabled;
|
top[FPSTR("enabled")] = enabled;
|
||||||
top[FPSTR(_shtType)] = shtType;
|
top[FPSTR(_shtType)] = shtType;
|
||||||
top[FPSTR(_unitOfTemp)] = unitOfTemp;
|
top[FPSTR(_unitOfTemp)] = unitOfTemp;
|
||||||
top[FPSTR(_haMqttDiscovery)] = haMqttDiscovery;
|
top[FPSTR(_haMqttDiscovery)] = haMqttDiscovery;
|
||||||
@@ -421,7 +421,7 @@ bool ShtUsermod::readFromConfig(JsonObject &root)
|
|||||||
byte oldUnitOfTemp = unitOfTemp;
|
byte oldUnitOfTemp = unitOfTemp;
|
||||||
bool oldHaMqttDiscovery = haMqttDiscovery;
|
bool oldHaMqttDiscovery = haMqttDiscovery;
|
||||||
|
|
||||||
getJsonValue(top[FPSTR(_enabled)], enabled);
|
getJsonValue(top[FPSTR("enabled")], enabled);
|
||||||
getJsonValue(top[FPSTR(_shtType)], shtType);
|
getJsonValue(top[FPSTR(_shtType)], shtType);
|
||||||
getJsonValue(top[FPSTR(_unitOfTemp)], unitOfTemp);
|
getJsonValue(top[FPSTR(_unitOfTemp)], unitOfTemp);
|
||||||
getJsonValue(top[FPSTR(_haMqttDiscovery)], haMqttDiscovery);
|
getJsonValue(top[FPSTR(_haMqttDiscovery)], haMqttDiscovery);
|
||||||
|
|||||||
Reference in New Issue
Block a user