diff --git a/src/main.cpp b/src/main.cpp index fe6cbcd..7ec3c92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -334,13 +334,15 @@ void handleData1Interrupt() { // Process the response DynamicJsonDocument json = httpClient.decodeJsonResponse(response); - bool DisableDoor = json["enabled"].as(); - settings.setDisableDoor(!DisableDoor); + if (json.containsKey("enabled")) { + bool DisableDoor = json["enabled"].as(); + settings.setDisableDoor(!DisableDoor); + #ifdef SERIAL_DEBUG + Serial.println("JSON Reader Enabled: " + json["enabled"].as()); + #endif + } + - #ifdef SERIAL_DEBUG - Serial.println("JSON Reader Enabled: " + json["enabled"].as()); - #endif - } }