0.8.103..15

This commit is contained in:
Patrick Amrhein 2024-05-14 17:09:49 +02:00
parent e363422e97
commit 58f6a5f4fc
7 changed files with 45 additions and 63 deletions

View file

@ -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 = "";