better handling of backend not being reachable

This commit is contained in:
Matthew Frost 2023-12-27 22:17:00 +01:00
parent f9a6c4fec2
commit 4602b4a35b

View file

@ -334,13 +334,15 @@ void handleData1Interrupt() {
// Process the response
DynamicJsonDocument json = httpClient.decodeJsonResponse(response);
bool DisableDoor = json["enabled"].as<bool>();
settings.setDisableDoor(!DisableDoor);
if (json.containsKey("enabled")) {
bool DisableDoor = json["enabled"].as<bool>();
settings.setDisableDoor(!DisableDoor);
#ifdef SERIAL_DEBUG
Serial.println("JSON Reader Enabled: " + json["enabled"].as<String>());
#endif
}
#ifdef SERIAL_DEBUG
Serial.println("JSON Reader Enabled: " + json["enabled"].as<String>());
#endif
}
}