From 9e828eccf62c88284e4822d6fb97d7a6d897fcae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Kristan?= Date: Mon, 8 Aug 2022 13:36:13 +0200 Subject: [PATCH] Fix for {on:"t",bri:100} --- wled00/json.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index 202675f8d..347d742d6 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -318,10 +318,12 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) bool onBefore = bri; getVal(root["bri"], &bri); - bool on = root["on"] | (bri > 0); - if (!on != !bri) toggleOnOff(); - - if (root["on"].is() && root["on"].as()[0] == 't') toggleOnOff(); + if (root["on"].isNull()) { + if ((onBefore && bri==0) || (!onBefore && bri>0)) toggleOnOff(); + } else { + bool on = root["on"] | onBefore; + if (on != onBefore || (root["on"].is() && root["on"].as()[0] == 't')) toggleOnOff(); + } if (bri && !onBefore) { // unfreeze all segments when turning on for (size_t s=0; s < strip.getSegmentsNum(); s++) {