Browse Source

zero-0.8.850023

pull/1474/head
Patrick Amrhein 11 months ago
parent
commit
2f17080ff3
  1. 8
      src/config/settings.h
  2. 2
      src/defines.h
  3. 4
      src/web/RestApi.h
  4. 40
      src/web/html/setup.html

8
src/config/settings.h

@ -234,8 +234,8 @@ typedef enum {
typedef struct {
bool enabled;
uint8_t id;
uint8_t target;
int8_t id;
int8_t target;
bool twoPercent;
uint16_t powerMax;
@ -908,9 +908,9 @@ class settings {
if (obj.containsKey(F("enabled")))
getVal<bool>(obj, F("enabled"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].enabled);
if (obj.containsKey(F("id")))
getVal<uint8_t>(obj, F("id"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].id);
getVal<int8_t>(obj, F("id"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].id);
if (obj.containsKey(F("target")))
getVal<uint8_t>(obj, F("target"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].target);
getVal<int8_t>(obj, F("target"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].target);
if (obj.containsKey(F("twoPercent")))
getVal<bool>(obj, F("twoPercent"), &mCfg.plugin.zeroExport.groups[group].inverters[inv].twoPercent);
if (obj.containsKey(F("powerMax")))

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 850021
#define VERSION_PATCH 850023
//-------------------------------------
typedef struct {

4
src/web/RestApi.h

@ -736,8 +736,8 @@ class RestApi {
for(uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) {
JsonObject objGroupInv = arrInv.createNestedObject();
objGroupInv[F("enabled")] = (bool)mConfig->plugin.zeroExport.groups[group].inverters[inv].enabled;
objGroupInv[F("id")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].id;
objGroupInv[F("target")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].target;
objGroupInv[F("id")] = (int8_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].id;
objGroupInv[F("target")] = (int8_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].target;
objGroupInv[F("twoPercent")] = (bool)mConfig->plugin.zeroExport.groups[group].inverters[inv].twoPercent;
objGroupInv[F("powerMax")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].inverters[inv].powerMax;
}

40
src/web/html/setup.html

@ -1176,25 +1176,7 @@
/*IF_PLUGIN_ZEROEXPORT*/
// Plugin ZeroExport
function parseZeroExportGroup_Modal_Iv(root) {
if (root == null)
return;
var invMax = document.getElementById("invMax").value;
for (var inv = 0; inv < invMax; inv++) {
var e = document.getElementById("invId"+inv);
selDelAllOpt(e);
// e.appendChild(opt(-1, "---"));
// TODO: Verhindert die Funktion des selects egal ob -1 oder "-1"
for (var i = 0; i < root.inverter.length; i++) {
e.appendChild(opt((root.inverter[i].id), (root.inverter[i].name)));
}
}
}
function ZeroExportGroup_Modal(obj) {
function ZeroExportGroup_Modal(obj, ivObj) {
// Tab_General
var cbEnabled = ml("input", {name: "enabled", type: "checkbox"}, null);
@ -1331,17 +1313,18 @@
e.checked = (obj.inverters[inv].enabled);
}
// - InverterId
getAjax("/api/inverter/list", parseZeroExportGroup_Modal_Iv);
for (var inv = 0; inv < maxInv; inv++) {
var e = document.getElementById("invId"+inv);
console.log(e);
selDelAllOpt(e);
e.appendChild(opt("-1", "---"));
// TODO: Verhindert die Funktion des selects egal ob -1 oder "-1"
for (var i = 0; i < ivObj.inverter.length; i++) {
e.appendChild(opt((ivObj.inverter[i].id), (ivObj.inverter[i].name)));
}
//e.selectedIndex = (obj.inverters[inv].id);
console.log(e.length)
for (var i = 0; i < (e.length); i++) {
console.log(i);
if (e.options[i].value == obj.inverters[inv].id) {
e.selectedIndex = i;
console.log(i);
}
}
}
@ -1349,6 +1332,7 @@ console.log(i);
for (var inv = 0; inv < maxInv; inv++) {
var e = document.getElementById("invTarget"+inv);
selDelAllOpt(e);
e.appendChild(opt("-1", "---"));
e.appendChild(opt("0", "Sum"));
e.appendChild(opt("1", "L1"));
e.appendChild(opt("2", "L2"));
@ -1515,7 +1499,13 @@ console.log(i);
ml("td", {style: "text-align: center;", }, String(obj.groups[group].id)),
ml("td", {style: "text-align: left;", }, String(obj.groups[group].name)),
ml("td", {style: "text-align: right;", id: "groupPowerTotal"+group}, "n/a"),
ml("td", {style: "text-align: center;", onclick: function() {ZeroExportGroup_Modal(obj.groups[group]);}}, svg(iconGear, 25, 25, "icon icon-fg pointer")),
// ml("td", {style: "text-align: center;", onclick: function() {ZeroExportGroup_Modal(obj.groups[group]);}}, svg(iconGear, 25, 25, "icon icon-fg pointer")),
ml("td", {style: "text-align: center;", onclick: function() {
function zeroGetIvList(ivObj) {
ZeroExportGroup_Modal(obj.groups[group], ivObj)
}
getAjax("/api/inverter/list", zeroGetIvList)
}}, svg(iconGear, 25, 25, "icon icon-fg pointer")),
ml("td", {style: "text-align: center;", onclick: function() {ZeroExportGroup_Del(obj.groups[group]);}}, svg(iconDel, 25, 25, "icon icon-fg pointer"))
]));
}

Loading…
Cancel
Save