diff --git a/usermods/multi_relay/usermod_multi_relay.h b/usermods/multi_relay/usermod_multi_relay.h index 3e0cc833..7381a00d 100644 --- a/usermods/multi_relay/usermod_multi_relay.h +++ b/usermods/multi_relay/usermod_multi_relay.h @@ -293,8 +293,8 @@ class MultiRelay : public Usermod { json[F("stat_t")] = "~"; json[F("cmd_t")] = F("~/command"); - json[F("pl_off")] = F("off"); - json[F("pl_on")] = F("on"); + json[F("pl_off")] = "off"; + json[F("pl_on")] = "on"; json[F("uniq_id")] = uid; strcpy(buf, mqttDeviceTopic); //max length: 33 + 7 = 40 diff --git a/wled00/json.cpp b/wled00/json.cpp index 7115f293..1bea4186 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -309,7 +309,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) receiveNotifications = udpn["recv"] | receiveNotifications; if ((bool)udpn[F("nn")]) callMode = CALL_MODE_NO_NOTIFY; //send no notification just for this request - unsigned long timein = root[F("time")] | UINT32_MAX; //backup time source if NTP not synced + unsigned long timein = root["time"] | UINT32_MAX; //backup time source if NTP not synced if (timein != UINT32_MAX) { setTimeFromAPI(timein); if (presetsModifiedTime == 0) presetsModifiedTime = timein; @@ -396,8 +396,8 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId) // b) preset ID only or preset that does not change state (use embedded cycling limits if they exist in getVal()) presetCycCurr = ps; presetId = ps; - root.remove(F("v")); // may be added in UI call - root.remove(F("time")); // may be added in UI call + root.remove("v"); // may be added in UI call + root.remove("time"); // may be added in UI call root.remove("ps"); if (root.size() == 0) { applyPreset(ps, callMode); // async load (only preset ID was specified) diff --git a/wled00/presets.cpp b/wled00/presets.cpp index 96e3bb59..29f88bec 100644 --- a/wled00/presets.cpp +++ b/wled00/presets.cpp @@ -36,13 +36,13 @@ static void doSaveState() { } sObj["n"] = saveName; if (quickLoad[0]) sObj[F("ql")] = quickLoad; - +/* #ifdef WLED_DEBUG DEBUG_PRINTLN(F("Serialized preset")); serializeJson(doc,Serial); DEBUG_PRINTLN(); #endif - +*/ #if defined(ARDUINO_ARCH_ESP32) if (!persist) { if (tmpRAMbuffer!=nullptr) free(tmpRAMbuffer); @@ -165,7 +165,7 @@ void savePreset(byte index, const char* pname, JsonObject sObj) playlistSave = false; if (sObj[F("ql")].is()) strlcpy(quickLoad, sObj[F("ql")].as(), 3); // only 2 chars for QL sObj.remove("v"); - sObj.remove(F("time")); + sObj.remove("time"); sObj.remove(F("error")); sObj.remove(F("psave")); if (sObj["o"].isNull()) { // "o" marks a playlist or manually entered API @@ -196,7 +196,7 @@ void savePreset(byte index, const char* pname, JsonObject sObj) void deletePreset(byte index) { StaticJsonDocument<24> empty; - writeObjectToFileUsingId("/presets.json", index, &empty); + writeObjectToFileUsingId(getName(), index, &empty); presetsModifiedTime = toki.second(); //unix time updateFSInfo(); } \ No newline at end of file