diff --git a/src/config/settings.h b/src/config/settings.h index c5df2d48..cc5f1ddf 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -262,6 +262,7 @@ typedef struct { int8_t target; uint16_t powerMin; uint16_t powerMax; + bool turnOff; // zeroExportAction_t action; @@ -681,6 +682,7 @@ class settings { mCfg.plugin.zeroExport.groups[group].inverters[inv].target = -1; mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMin = 10; mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMax = 600; + mCfg.plugin.zeroExport.groups[group].inverters[inv].turnOff = false; // mCfg.plugin.zeroExport.groups[group].inverters[inv].waitAck = 0; mCfg.plugin.zeroExport.groups[group].inverters[inv].action = zeroExportAction_t::doNone; @@ -1006,6 +1008,7 @@ class settings { obj[F("target")] = mCfg.plugin.zeroExport.groups[group].inverters[inv].target; obj[F("powerMin")] = mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMin; obj[F("powerMax")] = mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMax; + obj[F("turnOff")] = mCfg.plugin.zeroExport.groups[group].inverters[inv].turnOff; } else { if (obj.containsKey(F("enabled"))) getVal(obj, F("enabled"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].enabled); @@ -1017,6 +1020,8 @@ class settings { getVal(obj, F("powerMin"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMin); if (obj.containsKey(F("powerMax"))) getVal(obj, F("powerMax"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].powerMax); + if (obj.containsKey(F("turnOff"))) + getVal(obj, F("turnOff"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].turnOff); } } diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index a4caffde..d70f5e3f 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -253,8 +253,7 @@ class ZeroExport { mLog["do"] = "doTurnOn"; } } -// TODO: hier kommt eine CheckBox je Gruppe rein, die es verhindert, dass Inv ausgeschaltet werden. - if ((CfgGroupInv->limitNew <= 0) && (CfgGroupInv->power > 0)) { + if ((CfgGroupInv->turnOff) && (CfgGroupInv->limitNew <= 0) && (CfgGroupInv->power > 0)) { if (CfgGroupInv->actionTimer > 0) CfgGroupInv->actionTimer = 0; if (CfgGroupInv->actionTimer == 0) CfgGroupInv->actionTimer = -1; if (CfgGroupInv->actionTimer < 30) { diff --git a/src/web/RestApi.h b/src/web/RestApi.h index fbae1dba..5b34f1dd 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -852,6 +852,7 @@ class RestApi { objGroupInv[F("target")] = (int8_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].target; objGroupInv[F("powerMin")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].powerMin; objGroupInv[F("powerMax")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].powerMax; + objGroupInv[F("turnOff")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].turnOff; } // Battery objGroup[F("battEnabled")] = (bool)mConfig->plugin.zeroExport.groups[group].battEnabled; @@ -1167,6 +1168,7 @@ class RestApi { mConfig->plugin.zeroExport.groups[group].inverters[inv].target = jsonIn[F("inverters")][inv][F("target")]; mConfig->plugin.zeroExport.groups[group].inverters[inv].powerMin = jsonIn[F("inverters")][inv][F("powerMin")]; mConfig->plugin.zeroExport.groups[group].inverters[inv].powerMax = jsonIn[F("inverters")][inv][F("powerMax")]; + mConfig->plugin.zeroExport.groups[group].inverters[inv].turnOff = jsonIn[F("inverters")][inv][F("turnOff")]; } // Battery mConfig->plugin.zeroExport.groups[group].battEnabled = jsonIn[F("battEnabled")]; diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 725c1605..dd96a53a 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -1324,6 +1324,7 @@ ml("th", {}, "{#ZE_GROUP_TAB_INVERTER_SUM}"), ml("th", {style: "width: 15%;"}, "{#ZE_GROUP_TAB_INVERTER_POWERMIN}"), ml("th", {style: "width: 15%;"}, "{#ZE_GROUP_TAB_INVERTER_POWERMAX}"), + ml("th", {style: "width: 5%;"}, "{#ZE_GROUP_TAB_INVERTER_TURNOFF}"), ])); for(var inv = 0; inv < maxInv; inv++) { @@ -1331,7 +1332,7 @@ ml("td", {}, String(inv)), ml("td", {}, ml("div", {}, [ - ml("input", {name: "invEnabled"+inv, class: "text", id: "invEnabled"+inv, type: "checkbox"}, null) + ml("input", {name: "invEnabled"+inv, class: "text", id: "invEnabled"+inv, type: "checkbox"}, null) ]), ), ml("td", {}, @@ -1354,6 +1355,11 @@ ml("input", {name: "invPowerMax"+inv, class: "text", id: "invPowerMax"+inv, type: "number", min: "0", max: "65535"}, null) ]), ), + ml("td", {}, + ml("div", {}, [ + ml("input", {name: "invTurnOff"+inv, class: "text", id: "invTurnOff"+inv, type: "checkbox"}, null) + ]), + ), ])); } @@ -1384,6 +1390,10 @@ ]), // 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_TYPE}", ml("select", {name: "pm_type", class: "text", id: "pm_type"}, null), ), @@ -1531,6 +1541,11 @@ var e = document.getElementById("invPowerMax"+inv); e.value = (obj.inverters[inv].powerMax); } + // - TurnOff + for (var inv = 0; inv < maxInv; inv++) { + var e = document.getElementById("invTurnOff"+inv); + e.checked = (obj.inverters[inv].turnOff); + } function save() { var o = new Object(); @@ -1560,6 +1575,7 @@ q.target = e.options[e.selectedIndex].value; q.powerMin = document.getElementById("invPowerMin"+inv).value; q.powerMax = document.getElementById("invPowerMax"+inv).value; + q.turnOff = document.getElementById("invTurnOff"+inv).checked; o.inverters.push(q); } // Battery diff --git a/src/web/lang.json b/src/web/lang.json index 637e1c9a..ab4efa39 100644 --- a/src/web/lang.json +++ b/src/web/lang.json @@ -938,6 +938,11 @@ "en": "Power (Max)", "de": "Leistung (Max)" }, + { + "token": "ZE_GROUP_TAB_INVERTER_TURNOFF", + "en": "Turn On/Off", + "de": "Schalte Ein/Aus" + }, { "token": "ZE_GROUP_TAB_BATTERY", "en": "Battery",