mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-02 02:31:38 +02:00
0.8.103..15
This commit is contained in:
parent
e363422e97
commit
58f6a5f4fc
7 changed files with 45 additions and 63 deletions
|
@ -839,7 +839,7 @@ class RestApi {
|
|||
// 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_src")] = String(mConfig->plugin.zeroExport.groups[group].pm_src);
|
||||
objGroup[F("pm_jsonPath")] = String(mConfig->plugin.zeroExport.groups[group].pm_jsonPath);
|
||||
objGroup[F("pm_user")] = String(mConfig->plugin.zeroExport.groups[group].pm_user);
|
||||
objGroup[F("pm_pass")] = String(mConfig->plugin.zeroExport.groups[group].pm_pass);
|
||||
|
@ -1159,7 +1159,7 @@ class RestApi {
|
|||
// 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_src, ZEROEXPORT_GROUP_MAX_LEN_PM_SRC, "%s", jsonIn[F("pm_src")].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*>());
|
||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_user, ZEROEXPORT_GROUP_MAX_LEN_PM_USER, "%s", jsonIn[F("pm_user")].as<const char*>());
|
||||
snprintf(mConfig->plugin.zeroExport.groups[group].pm_pass, ZEROEXPORT_GROUP_MAX_LEN_PM_PASS, "%s", jsonIn[F("pm_pass")].as<const char*>());
|
||||
|
|
|
@ -1389,12 +1389,11 @@
|
|||
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),
|
||||
),
|
||||
// TODO: URL -> IP
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_TARGET}",
|
||||
ml("select", {name: "pm_target", class: "text", id: "pm_target"}, null),
|
||||
),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_IP}", [
|
||||
ml("input", {name: "pm_url", class: "text", type: "text", value: obj.pm_url, maxlength: "100"}, null),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_SRC}", [
|
||||
ml("input", {name: "pm_src", class: "text", type: "text", value: obj.pm_src, maxlength: "100"}, null),
|
||||
]),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_JSONPATH}", [
|
||||
ml("input", {name: "pm_jsonPath", class: "text", type: "text", value: obj.pm_jsonPath}, null),
|
||||
|
@ -1405,9 +1404,6 @@
|
|||
divRow("{#ZE_GROUP_TAB_POWERMETER_PASS}",
|
||||
ml("input", {name: "pm_pass", class: "text", type: "password", value: "****"}, null),
|
||||
),
|
||||
divRow("{#ZE_GROUP_TAB_POWERMETER_TOPIC}",
|
||||
ml("input", {id: 3, name: "pm_topic", class: "text", type: "text", value: ""}, null),
|
||||
),
|
||||
// TODO: Uebersetzen mit lang.json und auf die entsprechende Dokuseite verlinken
|
||||
divRow("Hinweis: ",
|
||||
ml("a", {href: "https://docs.ahoydtu.de/de/latest/zeroExport.html"}, "Bitte beachten Sie die Ausfüllhinweise in der Dokumentation."),
|
||||
|
@ -1514,7 +1510,6 @@
|
|||
|
||||
// add addEventListener
|
||||
const selectElement = document.querySelector("#pm_type");
|
||||
//selectElement.addEventListener("change", (event) => { pm_type_dropdown() });
|
||||
selectElement.addEventListener("change", (event) => { pm_type_dropdown() });
|
||||
|
||||
// run event one time
|
||||
|
@ -1580,21 +1575,27 @@
|
|||
|
||||
// Formular for Powermeter-DropDown
|
||||
// show all DIVs and remove only what is not necessary
|
||||
// 1 = pm_refresh, 2 = pm_target, 3 = pm_src, 4 = pm_jsonPath, 5 = pm_user, 6 = pm_pass
|
||||
for(var i = 0; i < divsToHide.childElementCount; i++) divsToHide.childNodes[i].style.display = '';
|
||||
|
||||
if(value == "---") for(var i = 1; i < divsToHide.childElementCount; i++) divsToHide.childNodes[i].style.display = 'none';
|
||||
else if(value == "Shelly") {
|
||||
divsToHide.childNodes[7].style.display = 'none';
|
||||
divsToHide.childNodes[5].style.display = 'none';
|
||||
divsToHide.childNodes[6].style.display = 'none';
|
||||
}
|
||||
else if(value == "Mqtt") {
|
||||
divsToHide.childNodes[3].style.display = 'none';
|
||||
divsToHide.childNodes[1].style.display = 'none';
|
||||
divsToHide.childNodes[2].style.display = 'none';
|
||||
divsToHide.childNodes[4].style.display = 'none';
|
||||
divsToHide.childNodes[5].style.display = 'none';
|
||||
divsToHide.childNodes[6].style.display = 'none';
|
||||
}
|
||||
else if(value == "Tibber") {
|
||||
divsToHide.childNodes[4].style.display = 'none';
|
||||
divsToHide.childNodes[7].style.display = 'none';
|
||||
}
|
||||
else if(value == "Shrdzm") {
|
||||
divsToHide.childNodes[1].style.display = 'none';
|
||||
divsToHide.childNodes[2].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1611,7 +1612,7 @@
|
|||
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;
|
||||
o.pm_src = document.getElementsByName("pm_src")[0].value;
|
||||
o.pm_jsonPath = document.getElementsByName("pm_jsonPath")[0].value;
|
||||
o.pm_user = document.getElementsByName("pm_user")[0].value;
|
||||
o.pm_pass = document.getElementsByName("pm_pass")[0].value;
|
||||
|
@ -1678,7 +1679,7 @@
|
|||
// Powermeter
|
||||
o.pm_refresh = 5;
|
||||
o.pm_type = 0;
|
||||
o.pm_url = "";
|
||||
o.pm_src = "";
|
||||
o.pm_jsonPath = "";
|
||||
o.pm_user = "";
|
||||
o.pm_pass = "";
|
||||
|
|
|
@ -894,9 +894,9 @@
|
|||
"de": "Typ:"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_IP",
|
||||
"en": "IP:",
|
||||
"de": "IP:"
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_SRC",
|
||||
"en": "IP / Topic:",
|
||||
"de": "IP / Topic:"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_JSONPATH",
|
||||
|
@ -913,11 +913,6 @@
|
|||
"en": "Password:",
|
||||
"de": "Passwort:"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_TOPIC",
|
||||
"en": "Topic:",
|
||||
"de": "Topic:"
|
||||
},
|
||||
{
|
||||
"token": "ZE_GROUP_TAB_POWERMETER_TARGET",
|
||||
"en": "Target:",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue