From e9be9dcc83ef3a405be26247e75393db822d8140 Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Mon, 31 Mar 2025 14:51:53 +0700 Subject: [PATCH] Fix mqtt host still exist on local when on server is disabled --- src/AgConfigure.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AgConfigure.cpp b/src/AgConfigure.cpp index 37645d6..9f931c0 100644 --- a/src/AgConfigure.cpp +++ b/src/AgConfigure.cpp @@ -739,7 +739,13 @@ bool Configuration::parse(String data, bool isLocal) { jsonInvalid(); return false; } - } else { + } + else if (JSON.typeof_(root[jprop_mqttBrokerUrl]) == "null" and !isLocal) { + // So if its not available on the json and json comes from aigradient server + // then set its value to default (empty) + jconfig[jprop_mqttBrokerUrl] = jprop_mqttBrokerUrl_default; + } + else { if (jsonTypeInvalid(root[jprop_mqttBrokerUrl], "string")) { failedMessage = jsonTypeInvalidMessage(String(jprop_mqttBrokerUrl), "string");