Allows my home wiz lights to be timed on and off according to a schedule.
Diff: web/web-wiz-html.c
- Revision:
- 1:a6b120e4031a
- Parent:
- 0:9af80a39adcc
- Child:
- 2:d3fe00659967
--- a/web/web-wiz-html.c Mon May 10 08:24:22 2021 +0000 +++ b/web/web-wiz-html.c Tue May 11 11:02:48 2021 +0000 @@ -4,21 +4,32 @@ #include "web-nav-this.h" #include "web-add.h" +static void addButton(char* name, int index, char* value, char* label) +{ + //HttpAddF("<button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"%s%d\", \"%s\")'>%s</button>\r\n", name, index, value, label); + HttpAddF("<button style='width:0.8em; margin:0; margin-left:0.1em; padding:0;' onclick='AjaxSendNameValue(\"%s%d\", \"%s\")'>%s</button>\r\n", name, index, value, label); +} + static void addLight(int index) { - HttpAddText("<div style='display:flex;'>\r\n"); - HttpAddF (" <code style='width:10em;' id='ajax-mac-%d'></code>\r\n", index); - HttpAddF (" <input type='text' style='width:7em;' id='ajax-name-%d' onchange='AjaxSendNameValue(\"lnam%d\", this.value)'>\r\n", index, index); - HttpAddF (" <input type='text' style='width:7em;' id='ajax-room-%d' onchange='AjaxSendNameValue(\"lroo%d\", this.value)'>\r\n", index, index); - HttpAddF (" <div style='width:3em; text-align:right;' id='ajax-age-%d'></div>\r\n", index); - HttpAddF (" <div style='width:3em; text-align:right;' id='ajax-signal-%d'></div>\r\n", index); - HttpAddF (" <div style='width:2em; text-align:right;' id='ajax-on-%d'></div>\r\n", index); - HttpAddF (" <div style='width:3em; text-align:right;' id='ajax-dimmer-%d'></div>\r\n", index); - HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"ldel%d\", \"1\")'>x</button>\r\n", index); - HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lmov%d\", \"up\")'>^</button>\r\n", index); - HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lmov%d\", \"down\")'>v</button>\r\n", index); - HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lswi%d\", \"1\")'>1</button>\r\n", index); - HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lswi%d\", \"0\")'>0</button>\r\n", index); + HttpAddText("<div style='display:flex; align-items:center;'>\r\n"); + HttpAddF (" <input type='text' style='width:6.5em;' id='ajax-name-%d' onchange='AjaxSendNameValue(\"lnam%d\", this.value)'>\r\n", index, index); + HttpAddF (" <input type='text' style='width:4.5em;' id='ajax-room-%d' onchange='AjaxSendNameValue(\"lroo%d\", this.value)'>\r\n", index, index); + HttpAddF (" <div style='margin-left:0.1em;' class='led' id='ajax-led-%d' dir='ltr'></div>\r\n", index); + addButton("lswi", index, "1", "1"); + addButton("lswi", index, "0", "0"); + //HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lswi%d\", \"1\")'>1</button>\r\n", index); + //HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lswi%d\", \"0\")'>0</button>\r\n", index); + HttpAddF (" <code style='width:5em; text-align:right;' id='ajax-mac-%d'></code>\r\n", index); + HttpAddF (" <div style='width:2em; text-align:right;' id='ajax-age-%d'></div>\r\n", index); + HttpAddF (" <div style='width:2em; text-align:right;' id='ajax-signal-%d'></div>\r\n", index); + HttpAddF (" <div style='width:2em; text-align:right;' id='ajax-dimmer-%d'></div>\r\n", index); + //HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"ldel%d\", \"1\")'>x</button>\r\n", index); + //HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lmov%d\", \"up\")'>^</button>\r\n", index); + //HttpAddF (" <button style='width:0.8em; margin-bottom: 0.1em; margin-top:0em; margin-left:0.5em; padding:0;' onclick='AjaxSendNameValue(\"lmov%d\", \"down\")'>v</button>\r\n", index); + addButton("ldel", index, "1", "x"); + addButton("lmov", index, "up", "^"); + addButton("lmov", index, "down", "v"); HttpAddText("</div>\r\n"); }