mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-05 12:11:39 +02:00
Powermeter refresh hinzugefügt
This commit is contained in:
parent
9428bdc73a
commit
d60e65b538
5 changed files with 83 additions and 40 deletions
|
@ -242,7 +242,7 @@ class RestApi {
|
|||
if((len + index) != total)
|
||||
return; // not last frame - nothing to do
|
||||
|
||||
DynamicJsonDocument json(1000);
|
||||
DynamicJsonDocument json(2000);
|
||||
|
||||
AsyncJsonResponse* response = new AsyncJsonResponse(false, 200);
|
||||
JsonObject root = response->getRoot();
|
||||
|
@ -837,6 +837,7 @@ class RestApi {
|
|||
objGroup[F("enabled")] = (bool)mConfig->plugin.zeroExport.groups[group].enabled;
|
||||
objGroup[F("name")] = String(mConfig->plugin.zeroExport.groups[group].name);
|
||||
// Powermeter
|
||||
objGroup[F("pm_refresh")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].pm_refresh;
|
||||
objGroup[F("pm_type")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].pm_type;
|
||||
objGroup[F("pm_url")] = String(mConfig->plugin.zeroExport.groups[group].pm_url);
|
||||
objGroup[F("pm_jsonPath")] = String(mConfig->plugin.zeroExport.groups[group].pm_jsonPath);
|
||||
|
@ -1156,6 +1157,7 @@ class RestApi {
|
|||
mConfig->plugin.zeroExport.groups[group].enabled = jsonIn[F("enabled")];
|
||||
snprintf(mConfig->plugin.zeroExport.groups[group].name, ZEROEXPORT_GROUP_MAX_LEN_NAME, "%s", jsonIn[F("name")].as<const char*>());
|
||||
// Powermeter
|
||||
mConfig->plugin.zeroExport.groups[group].pm_refresh = jsonIn[F("pm_refresh")];
|
||||
mConfig->plugin.zeroExport.groups[group].pm_type = jsonIn[F("pm_type")];
|
||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_url, ZEROEXPORT_GROUP_MAX_LEN_PM_URL, "%s", jsonIn[F("pm_url")].as<const char*>());
|
||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_jsonPath, ZEROEXPORT_GROUP_MAX_LEN_PM_JSONPATH, "%s", jsonIn[F("pm_jsonPath")].as<const char*>());
|
||||
|
|
|
@ -1390,10 +1390,9 @@
|
|||
]),
|
||||
// Powermeter
|
||||
ml("div", {id: "div{#ZE_GROUP_TAB_POWERMETER}", class: "tab-content hide"}, [
|
||||
// TODO: add
|
||||
//divRow("{#ZE_GROUP_TAB_POWERMETER_REFRESH}",
|
||||
//ml("select", {name: "pm_refresh", class: "text", type: "text", value: obj.pm_refresh}, null),
|
||||
//),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_REFRESH}",
|
||||
ml("input", {name: "pm_refresh", class: "text", type: "number", min: "1", max: "30", step: "1", value: obj.pm_refresh}, null),
|
||||
),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_TYPE}",
|
||||
ml("select", {name: "pm_type", class: "text", id: "pm_type"}, null),
|
||||
),
|
||||
|
@ -1556,7 +1555,7 @@
|
|||
o.enabled = document.getElementsByName("enabled")[0].checked;
|
||||
o.name = document.getElementsByName("name")[0].value;
|
||||
// Powermeter
|
||||
//o.pm_type = document.getElementsByName("pm_type")[0].selectedIndex;
|
||||
o.pm_refresh = document.getElementsByName("pm_refresh")[0].value;
|
||||
var e = document.getElementsByName("pm_type")[0];
|
||||
o.pm_type = e.options[e.selectedIndex].value;
|
||||
o.pm_url = document.getElementsByName("pm_url")[0].value;
|
||||
|
@ -1623,6 +1622,7 @@
|
|||
o.enabled = false;
|
||||
o.name = "";
|
||||
// Powermeter
|
||||
o.pm_refresh = 5;
|
||||
o.pm_type = 0;
|
||||
o.pm_url = "";
|
||||
o.pm_jsonPath = "";
|
||||
|
@ -1640,6 +1640,7 @@
|
|||
q.target = -1;
|
||||
q.powerMin = 0;
|
||||
q.powerMax = 0;
|
||||
q.turnOff = false;
|
||||
o.inverters.push(q);
|
||||
}
|
||||
// Battery
|
||||
|
|
|
@ -883,6 +883,11 @@
|
|||
"en": "Powermeter",
|
||||
"de": "Leistungsmessung"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_REFRESH",
|
||||
"en": "Refresh (s):",
|
||||
"de": "Zykluszeit (s):"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_TYPE",
|
||||
"en": "Type:",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue