Skip to content

Commit

Permalink
Fixed persistent store flag for JustTextPlugin, IconTextLampPlugin an…
Browse files Browse the repository at this point in the history
…d IconTextPlugin.
  • Loading branch information
BlueAndi committed Jan 6, 2025
1 parent 4772d37 commit d3dbd95
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 11 deletions.
16 changes: 14 additions & 2 deletions lib/IconTextLampPlugin/src/IconTextLampPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,20 @@ bool IconTextLampPlugin::setTopic(const String& topic, const JsonObjectConst& va
*/
if (false == jsonStoreFlag.isNull())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
if (true == jsonStoreFlag.is<String>())
{
storeFlag = jsonStoreFlag.as<String>().equalsIgnoreCase("true");
isSuccessful = true;
}
else if (true == jsonStoreFlag.is<bool>())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
}
else
{
;
}
}

if (true == isSuccessful)
Expand Down
16 changes: 14 additions & 2 deletions lib/IconTextPlugin/src/IconTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,20 @@ bool IconTextPlugin::setTopic(const String& topic, const JsonObjectConst& value)
*/
if (false == jsonStoreFlag.isNull())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
if (true == jsonStoreFlag.is<String>())
{
storeFlag = jsonStoreFlag.as<String>().equalsIgnoreCase("true");
isSuccessful = true;
}
else if (true == jsonStoreFlag.is<bool>())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
}
else
{
;
}
}

if (true == isSuccessful)
Expand Down
16 changes: 14 additions & 2 deletions lib/JustTextPlugin/src/JustTextPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,20 @@ bool JustTextPlugin::setTopic(const String& topic, const JsonObjectConst& value)
*/
if (false == jsonStoreFlag.isNull())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
if (true == jsonStoreFlag.is<String>())
{
storeFlag = jsonStoreFlag.as<String>().equalsIgnoreCase("true");
isSuccessful = true;
}
else if (true == jsonStoreFlag.is<bool>())
{
storeFlag = jsonStoreFlag.as<bool>();
isSuccessful = true;
}
else
{
;
}
}

if (true == isSuccessful)
Expand Down
10 changes: 5 additions & 5 deletions lib/TimerService/src/TimerSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ bool TimerSetting::fromJson(const JsonObjectConst& jsonTimerSetting)
m_displayState = static_cast<DisplayState>(jsonDisplayState.as<uint8_t>());
m_brightness = jsonBrightness.as<int16_t>();

if (true == jsonEnabled.is<bool>())
if (true == jsonEnabled.is<String>())
{
m_isEnabled = jsonEnabled.as<bool>();
m_isEnabled = jsonEnabled.as<String>().equalsIgnoreCase("true");
}
else if (true == jsonEnabled.as<String>().equals("false"))
else if (true == jsonEnabled.is<bool>())
{
m_isEnabled = false;
m_isEnabled = jsonEnabled.as<bool>();
}
else
{
m_isEnabled = true;
m_isEnabled = false;
}

if (((true == jsonSunday.is<bool>()) && (true == jsonSunday.as<bool>())) ||
Expand Down

0 comments on commit d3dbd95

Please sign in to comment.