Update ProgrammableHub2.ino

This commit is contained in:
Gregg 2022-08-07 19:45:42 -05:00
parent 546f4445e5
commit 59f60d8800
1 changed files with 19 additions and 2 deletions

View File

@ -304,7 +304,9 @@ void setupWeb(){
response += "</form>"; response += "</form>";
if(!openSlots) if(!openSlots)
response += "<p>Can't add any more Light Accessories. Max="+ String(MAX_LIGHTS) + "<p>"; response += "<p>Can't add any more Light Accessories. Max="+ String(MAX_LIGHTS) + "</p>";
response += "<p>Press here to update the Home App when finished making changes: <button type='button' onclick=\"document.location='/update'\">Upddate HomeKit</button></p>";
response += "</body></html>"; response += "</body></html>";
webServer.send(200, "text/html", response); webServer.send(200, "text/html", response);
@ -316,7 +318,7 @@ void setupWeb(){
int index=atoi(webServer.arg(0).c_str()); int index=atoi(webServer.arg(0).c_str());
String response = "<html><head><title>HomeSpan Programmable Light Hub</title><meta http-equiv='refresh' content = '3; url=/'/></head>"; String response = "<html><head><title>HomeSpan Programmable Light Hub</title><meta http-equiv='refresh' content = '3; url=/'/></head>";
response += "<body>Deleted Light Accessory '" + String(lightData[index].name) + "'...</body></html>"; response += "<body>Deleting Light Accessory '" + String(lightData[index].name) + "'...</body></html>";
deleteAccessory(index); deleteAccessory(index);
@ -324,6 +326,21 @@ void setupWeb(){
}); });
webServer.on("/update", []() {
String response = "<html><head><title>HomeSpan Programmable Light Hub</title><meta http-equiv='refresh' content = '3; url=/'/></head><body>";
if(homeSpan.updateDatabase())
response += "Accessories Database updated. New configuration number broadcasted...";
else
response += "Nothing to update - no changes were made...";
response += "...</body></html>";
webServer.send(200, "text/html", response);
});
webServer.on("/addLight", []() { webServer.on("/addLight", []() {
colorType_t colorType=NO_COLOR; colorType_t colorType=NO_COLOR;