2020-04-10 12:30:08 +02:00
|
|
|
#include "wled.h"
|
|
|
|
|
2016-12-31 00:38:51 +01:00
|
|
|
/*
|
|
|
|
* Sending XML status files to client
|
|
|
|
*/
|
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//build XML response to HTTP /win API request
|
2020-05-28 02:20:02 +02:00
|
|
|
void XML_response(AsyncWebServerRequest *request, char* dest)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2019-03-19 12:19:48 +01:00
|
|
|
char sbuf[(dest == nullptr)?1024:1]; //allocate local buffer if none passed
|
|
|
|
obuf = (dest == nullptr)? sbuf:dest;
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2019-03-16 02:09:37 +01:00
|
|
|
olen = 0;
|
2020-02-25 02:19:12 +01:00
|
|
|
oappend((const char*)F("<?xml version=\"1.0\" ?><vs><ac>"));
|
2020-06-22 12:30:31 +02:00
|
|
|
oappendi((nightlightActive && nightlightMode > NL_MODE_SET) ? briT : bri);
|
2018-11-09 17:00:36 +01:00
|
|
|
oappend("</ac>");
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
oappend("<cl>");
|
|
|
|
oappendi(col[i]);
|
|
|
|
oappend("</cl>");
|
|
|
|
}
|
2019-01-18 01:20:36 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
oappend("<cs>");
|
|
|
|
oappendi(colSec[i]);
|
|
|
|
oappend("</cs>");
|
|
|
|
}
|
2018-11-09 17:00:36 +01:00
|
|
|
oappend("<ns>");
|
|
|
|
oappendi(notifyDirect);
|
|
|
|
oappend("</ns><nr>");
|
|
|
|
oappendi(receiveNotifications);
|
|
|
|
oappend("</nr><nl>");
|
|
|
|
oappendi(nightlightActive);
|
|
|
|
oappend("</nl><nf>");
|
2020-06-22 12:30:31 +02:00
|
|
|
oappendi(nightlightMode > NL_MODE_SET);
|
2018-11-09 17:00:36 +01:00
|
|
|
oappend("</nf><nd>");
|
|
|
|
oappendi(nightlightDelayMins);
|
|
|
|
oappend("</nd><nt>");
|
|
|
|
oappendi(nightlightTargetBri);
|
|
|
|
oappend("</nt><fx>");
|
|
|
|
oappendi(effectCurrent);
|
|
|
|
oappend("</fx><sx>");
|
|
|
|
oappendi(effectSpeed);
|
|
|
|
oappend("</sx><ix>");
|
|
|
|
oappendi(effectIntensity);
|
|
|
|
oappend("</ix><fp>");
|
|
|
|
oappendi(effectPalette);
|
|
|
|
oappend("</fp><wv>");
|
2020-02-20 00:45:09 +01:00
|
|
|
if (strip.rgbwMode) {
|
2019-02-05 21:53:39 +01:00
|
|
|
oappendi(col[3]);
|
2018-11-09 17:00:36 +01:00
|
|
|
} else {
|
|
|
|
oappend("-1");
|
|
|
|
}
|
2019-01-18 01:20:36 +01:00
|
|
|
oappend("</wv><ws>");
|
2019-02-05 21:53:39 +01:00
|
|
|
oappendi(colSec[3]);
|
2020-01-19 01:07:38 +01:00
|
|
|
oappend("</ws><ps>");
|
|
|
|
oappendi((currentPreset < 1) ? 0:currentPreset);
|
|
|
|
oappend("</ps><cy>");
|
2019-02-05 19:40:24 +01:00
|
|
|
oappendi(presetCyclingEnabled);
|
|
|
|
oappend("</cy><ds>");
|
2020-02-09 19:10:29 +01:00
|
|
|
if (realtimeMode)
|
2019-02-19 12:57:50 +01:00
|
|
|
{
|
|
|
|
String mesg = "Live ";
|
2020-04-13 00:42:27 +02:00
|
|
|
if (realtimeMode == REALTIME_MODE_E131 || realtimeMode == REALTIME_MODE_ARTNET)
|
2019-02-19 12:57:50 +01:00
|
|
|
{
|
2020-04-13 00:42:27 +02:00
|
|
|
mesg += (realtimeMode == REALTIME_MODE_E131) ? "E1.31" : "Art-Net";
|
|
|
|
mesg += " mode ";
|
2020-02-08 20:52:45 +01:00
|
|
|
mesg += DMXMode;
|
2020-02-25 02:19:12 +01:00
|
|
|
mesg += F(" at DMX Address ");
|
2020-02-08 20:52:45 +01:00
|
|
|
mesg += DMXAddress;
|
2020-02-09 19:10:29 +01:00
|
|
|
mesg += " from ";
|
|
|
|
mesg += realtimeIP[0];
|
2020-02-08 20:52:45 +01:00
|
|
|
for (int i = 1; i < 4; i++)
|
|
|
|
{
|
|
|
|
mesg += ".";
|
2020-02-09 19:10:29 +01:00
|
|
|
mesg += realtimeIP[i];
|
2020-02-08 20:52:45 +01:00
|
|
|
}
|
2020-05-18 16:36:31 +02:00
|
|
|
} else if (realtimeMode == REALTIME_MODE_UDP || realtimeMode == REALTIME_MODE_HYPERION || realtimeMode == REALTIME_MODE_TPM2NET) {
|
2019-02-19 12:57:50 +01:00
|
|
|
mesg += "UDP from ";
|
|
|
|
mesg += realtimeIP[0];
|
|
|
|
for (int i = 1; i < 4; i++)
|
|
|
|
{
|
|
|
|
mesg += ".";
|
|
|
|
mesg += realtimeIP[i];
|
|
|
|
}
|
2020-02-09 19:10:29 +01:00
|
|
|
} else if (realtimeMode == REALTIME_MODE_ADALIGHT) {
|
2020-02-25 02:19:12 +01:00
|
|
|
mesg += F("USB Adalight");
|
2020-02-09 19:10:29 +01:00
|
|
|
} else { //generic
|
|
|
|
mesg += "data";
|
2019-02-19 12:57:50 +01:00
|
|
|
}
|
|
|
|
oappend((char*)mesg.c_str());
|
|
|
|
} else {
|
|
|
|
oappend(serverDescription);
|
|
|
|
}
|
2019-12-01 01:42:52 +01:00
|
|
|
oappend("</ds><ss>");
|
|
|
|
oappendi(strip.getMainSegmentId());
|
2019-12-02 12:41:35 +01:00
|
|
|
oappend("</ss></vs>");
|
2019-03-16 02:09:37 +01:00
|
|
|
if (request != nullptr) request->send(200, "text/xml", obuf);
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
|
|
|
|
2020-05-28 02:20:02 +02:00
|
|
|
void URL_response(AsyncWebServerRequest *request)
|
2020-02-24 12:18:30 +01:00
|
|
|
{
|
2020-05-28 02:20:02 +02:00
|
|
|
char sbuf[256];
|
2020-02-24 12:18:30 +01:00
|
|
|
char s2buf[100];
|
|
|
|
obuf = s2buf;
|
|
|
|
olen = 0;
|
|
|
|
|
|
|
|
char s[16];
|
|
|
|
oappend("http://");
|
|
|
|
IPAddress localIP = WiFi.localIP();
|
|
|
|
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
|
|
|
oappend(s);
|
|
|
|
oappend("/win&A=");
|
|
|
|
oappendi(bri);
|
|
|
|
oappend("&CL=h");
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
sprintf(s,"%02X", col[i]);
|
|
|
|
oappend(s);
|
|
|
|
}
|
|
|
|
oappend("&C2=h");
|
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
sprintf(s,"%02X", colSec[i]);
|
|
|
|
oappend(s);
|
|
|
|
}
|
|
|
|
oappend("&FX=");
|
|
|
|
oappendi(effectCurrent);
|
|
|
|
oappend("&SX=");
|
|
|
|
oappendi(effectSpeed);
|
|
|
|
oappend("&IX=");
|
|
|
|
oappendi(effectIntensity);
|
|
|
|
oappend("&FP=");
|
|
|
|
oappendi(effectPalette);
|
|
|
|
|
|
|
|
obuf = sbuf;
|
|
|
|
olen = 0;
|
|
|
|
|
2020-02-25 02:19:12 +01:00
|
|
|
oappend((const char*)F("<html><body><a href=\""));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappend(s2buf);
|
2020-02-25 02:19:12 +01:00
|
|
|
oappend((const char*)F("\" target=\"_blank\">"));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappend(s2buf);
|
2020-02-25 02:19:12 +01:00
|
|
|
oappend((const char*)F("</a></body></html>"));
|
2020-02-24 12:18:30 +01:00
|
|
|
|
|
|
|
if (request != nullptr) request->send(200, "text/html", obuf);
|
|
|
|
}
|
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//append a numeric setting to string buffer
|
2019-12-11 00:59:15 +01:00
|
|
|
void sappend(char stype, const char* key, int val)
|
2018-07-20 19:35:31 +02:00
|
|
|
{
|
|
|
|
char ds[] = "d.Sf.";
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
switch(stype)
|
|
|
|
{
|
|
|
|
case 'c': //checkbox
|
|
|
|
oappend(ds);
|
|
|
|
oappend(key);
|
|
|
|
oappend(".checked=");
|
|
|
|
oappendi(val);
|
|
|
|
oappend(";");
|
|
|
|
break;
|
|
|
|
case 'v': //numeric
|
|
|
|
oappend(ds);
|
|
|
|
oappend(key);
|
|
|
|
oappend(".value=");
|
|
|
|
oappendi(val);
|
|
|
|
oappend(";");
|
|
|
|
break;
|
|
|
|
case 'i': //selectedIndex
|
|
|
|
oappend(ds);
|
|
|
|
oappend(key);
|
|
|
|
oappend(".selectedIndex=");
|
|
|
|
oappendi(val);
|
|
|
|
oappend(";");
|
|
|
|
break;
|
2018-07-22 21:21:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//append a string setting to buffer
|
2019-12-11 00:59:15 +01:00
|
|
|
void sappends(char stype, const char* key, char* val)
|
2018-07-22 21:21:18 +02:00
|
|
|
{
|
|
|
|
switch(stype)
|
|
|
|
{
|
|
|
|
case 's': //string (we can interpret val as char*)
|
2018-11-09 17:00:36 +01:00
|
|
|
oappend("d.Sf.");
|
|
|
|
oappend(key);
|
|
|
|
oappend(".value=\"");
|
|
|
|
oappend(val);
|
|
|
|
oappend("\";");
|
|
|
|
break;
|
2018-07-20 19:35:31 +02:00
|
|
|
case 'm': //message
|
2018-11-09 17:00:36 +01:00
|
|
|
oappend("d.getElementsByClassName");
|
|
|
|
oappend(key);
|
|
|
|
oappend(".innerHTML=\"");
|
|
|
|
oappend(val);
|
|
|
|
oappend("\";");
|
|
|
|
break;
|
2018-07-20 19:35:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-11 17:57:06 +01:00
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//get values for settings form in javascript
|
2019-03-16 02:09:37 +01:00
|
|
|
void getSettingsJS(byte subPage, char* dest)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-01-27 23:28:20 +01:00
|
|
|
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
|
|
|
|
DEBUG_PRINT("settings resp");
|
|
|
|
DEBUG_PRINTLN(subPage);
|
2019-03-16 02:09:37 +01:00
|
|
|
obuf = dest;
|
|
|
|
olen = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2020-02-23 22:24:51 +01:00
|
|
|
if (subPage <1 || subPage >7) return;
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 1) {
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"CS",clientSSID);
|
2018-07-20 19:35:31 +02:00
|
|
|
|
2018-07-21 23:21:07 +02:00
|
|
|
byte l = strlen(clientPass);
|
2018-07-20 19:35:31 +02:00
|
|
|
char fpass[l+1]; //fill password field with ***
|
|
|
|
fpass[l] = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
memset(fpass,'*',l);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"CP",fpass);
|
2018-07-20 19:35:31 +02:00
|
|
|
|
|
|
|
char k[3]; k[2] = 0; //IP addresses
|
|
|
|
for (int i = 0; i<4; i++)
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2018-07-20 19:35:31 +02:00
|
|
|
k[1] = 48+i; //ascii 0,1,2,3
|
|
|
|
k[0] = 'I'; sappend('v',k,staticIP[i]);
|
|
|
|
k[0] = 'G'; sappend('v',k,staticGateway[i]);
|
|
|
|
k[0] = 'S'; sappend('v',k,staticSubnet[i]);
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2018-07-20 19:35:31 +02:00
|
|
|
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"CM",cmDNS);
|
2019-10-25 00:14:58 +02:00
|
|
|
sappend('i',"AB",apBehavior);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"AS",apSSID);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"AH",apHide);
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-21 23:21:07 +02:00
|
|
|
l = strlen(apPass);
|
2018-07-20 19:35:31 +02:00
|
|
|
char fapass[l+1]; //fill password field with ***
|
|
|
|
fapass[l] = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
memset(fapass,'*',l);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"AP",fapass);
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"AC",apChannel);
|
2020-02-20 17:08:56 +01:00
|
|
|
sappend('c',"WS",noWifiSleep);
|
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
|
|
|
|
if (WiFi.localIP()[0] != 0) //is connected
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2018-07-21 23:21:07 +02:00
|
|
|
char s[16];
|
|
|
|
IPAddress localIP = WiFi.localIP();
|
|
|
|
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('m',"(\"sip\")[0]",s);
|
2018-02-20 22:29:48 +01:00
|
|
|
} else
|
|
|
|
{
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('m',"(\"sip\")[0]","Not connected");
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
if (WiFi.softAPIP()[0] != 0) //is active
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2018-07-21 23:21:07 +02:00
|
|
|
char s[16];
|
|
|
|
IPAddress apIP = WiFi.softAPIP();
|
|
|
|
sprintf(s, "%d.%d.%d.%d", apIP[0], apIP[1], apIP[2], apIP[3]);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('m',"(\"sip\")[1]",s);
|
2018-02-20 22:29:48 +01:00
|
|
|
} else
|
|
|
|
{
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('m',"(\"sip\")[1]","Not active");
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-02-20 22:29:48 +01:00
|
|
|
if (subPage == 2) {
|
2019-11-12 19:33:34 +01:00
|
|
|
#ifdef ESP8266
|
|
|
|
#if LEDPIN == 3
|
|
|
|
oappend("d.Sf.LC.max=500;");
|
|
|
|
#endif
|
|
|
|
#endif
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"LC",ledCount);
|
2018-12-04 00:58:06 +01:00
|
|
|
sappend('v',"MA",strip.ablMilliampsMax);
|
2019-11-12 19:33:34 +01:00
|
|
|
sappend('v',"LA",strip.milliampsPerLed);
|
2018-12-04 00:58:06 +01:00
|
|
|
if (strip.currentMilliamps)
|
|
|
|
{
|
|
|
|
sappends('m',"(\"pow\")[0]","");
|
|
|
|
olen -= 2; //delete ";
|
|
|
|
oappendi(strip.currentMilliamps);
|
|
|
|
oappend("mA\";");
|
|
|
|
}
|
2019-12-04 02:01:47 +01:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"CA",briS);
|
|
|
|
sappend('c',"EW",useRGBW);
|
2018-11-28 12:24:32 +01:00
|
|
|
sappend('i',"CO",strip.colorOrder);
|
2020-02-20 00:45:09 +01:00
|
|
|
sappend('v',"AW",strip.rgbwMode);
|
2019-12-04 02:01:47 +01:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"BO",turnOnAtBoot);
|
|
|
|
sappend('v',"BP",bootPreset);
|
2019-12-04 02:01:47 +01:00
|
|
|
|
2019-05-22 00:23:09 +02:00
|
|
|
sappend('c',"GB",strip.gammaCorrectBri);
|
|
|
|
sappend('c',"GC",strip.gammaCorrectCol);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"TF",fadeTransition);
|
2019-12-05 01:58:03 +01:00
|
|
|
sappend('v',"TD",transitionDelayDefault);
|
2018-09-08 16:21:44 +02:00
|
|
|
sappend('c',"PF",strip.paletteFade);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"BF",briMultiplier);
|
|
|
|
sappend('v',"TB",nightlightTargetBri);
|
2018-11-21 23:28:20 +01:00
|
|
|
sappend('v',"TL",nightlightDelayMinsDefault);
|
2020-06-22 12:30:31 +02:00
|
|
|
sappend('v',"TW",nightlightMode);
|
2018-09-11 00:20:12 +02:00
|
|
|
sappend('i',"PB",strip.paletteBlend);
|
2019-05-22 00:23:09 +02:00
|
|
|
sappend('c',"RV",strip.reverseMode);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"SL",skipFirstLed);
|
2016-12-29 00:03:58 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
|
2018-02-20 22:29:48 +01:00
|
|
|
if (subPage == 3)
|
2019-08-17 12:27:06 +02:00
|
|
|
{
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"DS",serverDescription);
|
2019-12-13 01:23:07 +01:00
|
|
|
sappend('c',"ST",syncToggleReceive);
|
2017-11-20 00:07:37 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 4)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"BT",buttonEnabled);
|
2020-01-08 00:46:16 +01:00
|
|
|
sappend('v',"IR",irEnabled);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"UP",udpPort);
|
|
|
|
sappend('c',"RB",receiveNotificationBrightness);
|
|
|
|
sappend('c',"RC",receiveNotificationColor);
|
|
|
|
sappend('c',"RX",receiveNotificationEffects);
|
|
|
|
sappend('c',"SD",notifyDirectDefault);
|
|
|
|
sappend('c',"SB",notifyButton);
|
|
|
|
sappend('c',"SH",notifyHue);
|
2019-02-19 12:57:50 +01:00
|
|
|
sappend('c',"SM",notifyMacro);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"S2",notifyTwice);
|
|
|
|
sappend('c',"RD",receiveDirect);
|
2020-04-13 00:42:27 +02:00
|
|
|
sappend('v',"EP",e131Port);
|
2020-03-10 18:21:16 +01:00
|
|
|
sappend('c',"ES",e131SkipOutOfSequence);
|
2018-08-11 22:57:13 +02:00
|
|
|
sappend('c',"EM",e131Multicast);
|
|
|
|
sappend('v',"EU",e131Universe);
|
2020-02-08 20:52:45 +01:00
|
|
|
sappend('v',"DA",DMXAddress);
|
|
|
|
sappend('v',"DM",DMXMode);
|
2018-09-15 17:29:01 +02:00
|
|
|
sappend('v',"ET",realtimeTimeoutMs);
|
2018-08-11 22:57:13 +02:00
|
|
|
sappend('c',"FB",arlsForceMaxBri);
|
|
|
|
sappend('c',"RG",arlsDisableGammaCorrection);
|
|
|
|
sappend('v',"WO",arlsOffset);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"AL",alexaEnabled);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"AI",alexaInvocationName);
|
2018-09-15 17:29:01 +02:00
|
|
|
sappend('c',"SA",notifyAlexa);
|
2018-10-08 17:36:22 +02:00
|
|
|
sappends('s',"BK",(char*)((blynkEnabled)?"Hidden":""));
|
2019-12-11 00:59:15 +01:00
|
|
|
|
|
|
|
#ifdef WLED_ENABLE_MQTT
|
2019-12-13 01:23:07 +01:00
|
|
|
sappend('c',"MQ",mqttEnabled);
|
2018-10-04 16:50:12 +02:00
|
|
|
sappends('s',"MS",mqttServer);
|
2019-08-18 18:14:17 +02:00
|
|
|
sappend('v',"MQPORT",mqttPort);
|
|
|
|
sappends('s',"MQUSER",mqttUser);
|
|
|
|
sappends('s',"MQPASS",mqttPass);
|
|
|
|
byte l = strlen(mqttPass);
|
|
|
|
char fpass[l+1]; //fill password field with ***
|
|
|
|
fpass[l] = 0;
|
|
|
|
memset(fpass,'*',l);
|
|
|
|
sappends('s',"MQPASS",fpass);
|
|
|
|
sappends('s',"MQCID",mqttClientID);
|
2018-10-04 16:50:12 +02:00
|
|
|
sappends('s',"MD",mqttDeviceTopic);
|
|
|
|
sappends('s',"MG",mqttGroupTopic);
|
2019-12-11 00:59:15 +01:00
|
|
|
#endif
|
|
|
|
|
2020-02-25 02:19:12 +01:00
|
|
|
#ifndef WLED_DISABLE_HUESYNC
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"H0",hueIP[0]);
|
|
|
|
sappend('v',"H1",hueIP[1]);
|
|
|
|
sappend('v',"H2",hueIP[2]);
|
|
|
|
sappend('v',"H3",hueIP[3]);
|
|
|
|
sappend('v',"HL",huePollLightId);
|
|
|
|
sappend('v',"HI",huePollIntervalMs);
|
|
|
|
sappend('c',"HP",huePollingEnabled);
|
|
|
|
sappend('c',"HO",hueApplyOnOff);
|
|
|
|
sappend('c',"HB",hueApplyBri);
|
|
|
|
sappend('c',"HC",hueApplyColor);
|
2020-02-25 02:19:12 +01:00
|
|
|
char hueErrorString[25];
|
|
|
|
switch (hueError)
|
|
|
|
{
|
|
|
|
case HUE_ERROR_INACTIVE : strcpy(hueErrorString,(char*)F("Inactive")); break;
|
|
|
|
case HUE_ERROR_ACTIVE : strcpy(hueErrorString,(char*)F("Active")); break;
|
|
|
|
case HUE_ERROR_UNAUTHORIZED : strcpy(hueErrorString,(char*)F("Unauthorized")); break;
|
|
|
|
case HUE_ERROR_LIGHTID : strcpy(hueErrorString,(char*)F("Invalid light ID")); break;
|
|
|
|
case HUE_ERROR_PUSHLINK : strcpy(hueErrorString,(char*)F("Link button not pressed")); break;
|
|
|
|
case HUE_ERROR_JSON_PARSING : strcpy(hueErrorString,(char*)F("JSON parsing error")); break;
|
|
|
|
case HUE_ERROR_TIMEOUT : strcpy(hueErrorString,(char*)F("Timeout")); break;
|
|
|
|
default: sprintf(hueErrorString,"Bridge Error %i",hueError);
|
|
|
|
}
|
|
|
|
|
2020-04-30 01:52:36 +02:00
|
|
|
sappends('m',"(\"sip\")[0]",hueErrorString);
|
2019-12-11 00:59:15 +01:00
|
|
|
#endif
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 5)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"NT",ntpEnabled);
|
2019-12-04 02:01:47 +01:00
|
|
|
sappends('s',"NS",ntpServerName);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"CF",!useAMPM);
|
|
|
|
sappend('i',"TZ",currentTimezone);
|
|
|
|
sappend('v',"UO",utcOffsetSecs);
|
2019-03-16 02:09:37 +01:00
|
|
|
char tm[32];
|
2019-08-17 12:27:06 +02:00
|
|
|
getTimeString(tm);
|
2019-03-16 02:09:37 +01:00
|
|
|
sappends('m',"(\"times\")[0]",tm);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('i',"OL",overlayCurrent);
|
|
|
|
sappend('v',"O1",overlayMin);
|
|
|
|
sappend('v',"O2",overlayMax);
|
|
|
|
sappend('v',"OM",analogClock12pixel);
|
|
|
|
sappend('c',"OS",analogClockSecondsTrail);
|
|
|
|
sappend('c',"O5",analogClock5MinuteMarks);
|
2018-07-22 21:21:18 +02:00
|
|
|
sappends('s',"CX",cronixieDisplay);
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"CB",cronixieBacklight);
|
|
|
|
sappend('c',"CE",countdownMode);
|
|
|
|
sappend('v',"CY",countdownYear);
|
|
|
|
sappend('v',"CI",countdownMonth);
|
|
|
|
sappend('v',"CD",countdownDay);
|
|
|
|
sappend('v',"CH",countdownHour);
|
|
|
|
sappend('v',"CM",countdownMin);
|
|
|
|
sappend('v',"CS",countdownSec);
|
|
|
|
char k[4]; k[0]= 'M';
|
2018-03-06 23:47:08 +01:00
|
|
|
for (int i=1;i<17;i++)
|
|
|
|
{
|
2019-03-16 02:09:37 +01:00
|
|
|
char m[65];
|
|
|
|
loadMacro(i, m);
|
2018-07-20 19:35:31 +02:00
|
|
|
sprintf(k+1,"%i",i);
|
2019-03-16 02:09:37 +01:00
|
|
|
sappends('s',k,m);
|
2018-03-06 23:47:08 +01:00
|
|
|
}
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('v',"MB",macroBoot);
|
|
|
|
sappend('v',"A0",macroAlexaOn);
|
|
|
|
sappend('v',"A1",macroAlexaOff);
|
|
|
|
sappend('v',"MP",macroButton);
|
|
|
|
sappend('v',"ML",macroLongPress);
|
|
|
|
sappend('v',"MC",macroCountdown);
|
|
|
|
sappend('v',"MN",macroNl);
|
2019-03-13 11:13:03 +01:00
|
|
|
sappend('v',"MD",macroDoublePress);
|
2018-09-22 22:49:24 +02:00
|
|
|
|
|
|
|
k[2] = 0; //Time macros
|
|
|
|
for (int i = 0; i<8; i++)
|
|
|
|
{
|
|
|
|
k[1] = 48+i; //ascii 0,1,2,3
|
|
|
|
k[0] = 'H'; sappend('v',k,timerHours[i]);
|
|
|
|
k[0] = 'N'; sappend('v',k,timerMinutes[i]);
|
|
|
|
k[0] = 'T'; sappend('v',k,timerMacro[i]);
|
2019-01-31 00:09:44 +01:00
|
|
|
k[0] = 'W'; sappend('v',k,timerWeekday[i]);
|
2018-09-22 22:49:24 +02:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (subPage == 6)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-07-20 19:35:31 +02:00
|
|
|
sappend('c',"NO",otaLock);
|
|
|
|
sappend('c',"OW",wifiLock);
|
|
|
|
sappend('c',"AO",aOtaEnabled);
|
2020-04-30 01:52:36 +02:00
|
|
|
sappends('m',"(\"sip\")[0]","WLED ");
|
2018-07-20 19:35:31 +02:00
|
|
|
olen -= 2; //delete ";
|
|
|
|
oappend(versionString);
|
|
|
|
oappend(" (build ");
|
|
|
|
oappendi(VERSION);
|
2020-04-30 01:52:36 +02:00
|
|
|
oappend(")\";");
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2020-02-23 22:24:51 +01:00
|
|
|
|
|
|
|
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
|
|
|
if (subPage == 7)
|
|
|
|
{
|
2020-05-11 11:51:11 +02:00
|
|
|
sappend('v',"PU",e131ProxyUniverse);
|
|
|
|
|
2020-02-23 22:24:51 +01:00
|
|
|
sappend('v',"CN",DMXChannels);
|
|
|
|
sappend('v',"CG",DMXGap);
|
|
|
|
sappend('v',"CS",DMXStart);
|
2020-03-28 12:07:02 +01:00
|
|
|
sappend('v',"SL",DMXStartLED);
|
2020-02-23 22:24:51 +01:00
|
|
|
|
|
|
|
sappend('i',"CH1",DMXFixtureMap[0]);
|
|
|
|
sappend('i',"CH2",DMXFixtureMap[1]);
|
|
|
|
sappend('i',"CH3",DMXFixtureMap[2]);
|
|
|
|
sappend('i',"CH4",DMXFixtureMap[3]);
|
|
|
|
sappend('i',"CH5",DMXFixtureMap[4]);
|
|
|
|
sappend('i',"CH6",DMXFixtureMap[5]);
|
|
|
|
sappend('i',"CH7",DMXFixtureMap[6]);
|
|
|
|
sappend('i',"CH8",DMXFixtureMap[7]);
|
|
|
|
sappend('i',"CH9",DMXFixtureMap[8]);
|
|
|
|
sappend('i',"CH10",DMXFixtureMap[9]);
|
|
|
|
sappend('i',"CH11",DMXFixtureMap[10]);
|
|
|
|
sappend('i',"CH12",DMXFixtureMap[11]);
|
|
|
|
sappend('i',"CH13",DMXFixtureMap[12]);
|
|
|
|
sappend('i',"CH14",DMXFixtureMap[13]);
|
|
|
|
sappend('i',"CH15",DMXFixtureMap[14]);
|
|
|
|
}
|
|
|
|
#endif
|
2018-07-20 19:35:31 +02:00
|
|
|
oappend("}</script>");
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|