summaryrefslogtreecommitdiff
path: root/HouseControl.ino
diff options
context:
space:
mode:
Diffstat (limited to 'HouseControl.ino')
-rw-r--r--HouseControl.ino37
1 files changed, 33 insertions, 4 deletions
diff --git a/HouseControl.ino b/HouseControl.ino
index e18fbfc..369f84d 100644
--- a/HouseControl.ino
+++ b/HouseControl.ino
@@ -370,6 +370,8 @@ void configGetHandler(WebServer &server, WebServer::ConnectionType type, char *u
void configSetHandler(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) {
if (type == WebServer::POST) {
+ unsigned long int v;
+
server.httpSuccess();
while (server.readPOSTparam((char*)buf2, BUF2_SIZE, (char*)buf1, BUF1_SIZE)) {
if ((strcmp((const char*)buf2, "mac") == 0))
@@ -396,10 +398,37 @@ void configSetHandler(WebServer &server, WebServer::ConnectionType type, char *u
if ((strcmp((const char*)buf2, "stathost") == 0))
if (!str_to_ip(buf1, config.notifyhost)) { server.print(F("Invalid Status target host")); return; }
- server.print((char*)buf2);
- server.print(" = '");
- server.print((char*)buf1);
- server.print("'<br />\n");
+ if ((strcmp((const char*)buf2, "statport") == 0)) {
+ v = strtoul((char *)buf1, NULL, 10);
+ if (v < 1 || v > 65535) { server.print(F("Invalid Status target port")); return; }
+ config.notifyport = v;
+ }
+
+ if ((strcmp((const char*)buf2, "fd_utime") == 0)) {
+ v = strtoul((char *)buf1, NULL, 10);
+ if (v < 1 || v > 30) { server.print(F("Invalid Front Door unlock time")); return; }
+ config.frontdoor_unlocktime = v;
+ }
+
+ if ((strcmp((const char*)buf2, "gd_gtime") == 0)) {
+ v = strtoul((char *)buf1, NULL, 10);
+ if (v < 1 || v > 120) { server.print(F("Invalid Garage Door grace time")); return; }
+ config.garagedoor_gracetime = v;
+ }
+
+ if ((strcmp((const char*)buf2, "dawn") == 0)) {
+ char *n;
+ v = strtoul((char *)buf1, &n, 10);
+ if (v < 0 || v > 23 || n == (char*)buf1) { server.print(F("Invalid setting for 'dawn'")); return; }
+ config.dawn = v;
+ }
+
+ if ((strcmp((const char*)buf2, "dusk") == 0)) {
+ char *n;
+ v = strtoul((char *)buf1, &n, 10);
+ if (v < 0 || v > 23 || n == (char*)buf1) { server.print(F("Invalid setting for 'dusk'")); return; }
+ config.dusk = v;
+ }
}
server.print(F("Settings Saved Successfully"));
return;