//Handlers for Web Server void handle_index() { server.send(200, "text/html", "[OK] - hds 4-way relay module"); } void handle_status() { DynamicJsonDocument doc(256); //doc["relay1"] = relayStatus[0] ? true : false; //doc["relay2"] = relayStatus[1] ? true : false; //doc["relay3"] = relayStatus[2] ? true : false; //doc["relay4"] = relayStatus[3] ? true : false; String json; serializeJson(doc, json); server.send(200, "application/json", json.c_str()); } void handle_deviceInfo() { // Open the file in read mode File file = LittleFS.open("/config.json", "r"); if (!file) { // If the file doesn't exist, send a 404 Not Found response server.send(404, "application/json", "{\"error\":\"device config missing from firmware\"}"); return; } String fileContent = ""; while (file.available()) { fileContent += (char)file.read(); } file.close(); server.send(200, "application/json", fileContent); } void handle_uuid() { server.send(200, "application/json", "\"" + deviceUUID + "\""); }