Refactored MQTT payload handling into separate classes

This commit is contained in:
Gunnar Skjold
2021-01-17 20:11:04 +01:00
parent 53573184f3
commit 33070af111
23 changed files with 803 additions and 502 deletions

View File

@@ -272,9 +272,9 @@ var fetch = function() {
}
setStatus("esp", json.em);
setStatus("han", json.em == 3 ? 0 : json.hm);
setStatus("wifi", json.em == 3 ? 0 : json.wm);
setStatus("mqtt", json.em == 3 ? 0 : json.mm);
setStatus("han", json.hm);
setStatus("wifi", json.wm);
setStatus("mqtt", json.mm);
if(im && im.gaugeMeter) {
@@ -348,10 +348,10 @@ var fetch = function() {
}).fail(function() {
setTimeout(fetch, interval*4);
setStatus("mqtt", "secondary");
setStatus("wifi", "secondary");
setStatus("han", "secondary");
setStatus("esp", "danger");
setStatus("mqtt", 0);
setStatus("wifi", 0);
setStatus("han", 0);
setStatus("esp", 3);
});
}

6
web/domoticz.json Normal file
View File

@@ -0,0 +1,6 @@
{
"command" : "udevice",
"idx" : %d,
"nvalue" : 0,
"svalue" : "%s"
}

12
web/json1.json Normal file
View File

@@ -0,0 +1,12 @@
{
"id" : "%s",
"name" : "%s",
"up" : %d,
"t" : %d,
"vcc" : %.3f,
"rssi": %d,
"temp": %.2f,
"data" : {
"P" : %d
}
}

24
web/json2.json Normal file
View File

@@ -0,0 +1,24 @@
{
"id" : "%s",
"name" : "%s",
"up" : %d,
"t" : %d,
"vcc" : %.3f,
"rssi": %d,
"temp": %.2f,
"data" : {
"lv" : "%s",
"id" : "%s",
"type" : "%s",
"P" : %d,
"Q" : %d,
"PO" : %d,
"QO" : %d,
"I1" : %.2f,
"I2" : %.2f,
"I3" : %.2f,
"U1" : %.2f,
"U2" : %.2f,
"U3" : %.2f
}
}

29
web/json3.json Normal file
View File

@@ -0,0 +1,29 @@
{
"id" : "%s",
"name" : "%s",
"up" : %d,
"t" : %d,
"vcc" : %.3f,
"rssi": %d,
"temp": %.2f,
"data" : {
"lv" : "%s",
"id" : "%s",
"type" : "%s",
"P" : %d,
"Q" : %d,
"PO" : %d,
"QO" : %d,
"I1" : %.2f,
"I2" : %.2f,
"I3" : %.2f,
"U1" : %.2f,
"U2" : %.2f,
"U3" : %.2f,
"tPI" : %.1f,
"tPO" : %.1f,
"tQI" : %.1f,
"tQO" : %.1f,
"rtc" : %d
}
}

23
web/jsonprices.json Normal file
View File

@@ -0,0 +1,23 @@
{
"id" : "%s",
"prices" : {
"0" : %.4f,
"1" : %.4f,
"2" : %.4f,
"3" : %.4f,
"4" : %.4f,
"5" : %.4f,
"6" : %.4f,
"7" : %.4f,
"8" : %.4f,
"9" : %.4f,
"10" : %.4f,
"11" : %.4f,
"12" : %.4f,
"min" : %.4f,
"max" : %.4f,
"cheapest1hr" : "%s",
"cheapest3hr" : "%s",
"cheapest6hr" : "%s"
}
}

8
web/jsonsys.json Normal file
View File

@@ -0,0 +1,8 @@
{
"id" : "%s",
"name" : "%s",
"up" : %d,
"vcc" : %.3f,
"rssi": %d,
"temp": %.2f
}