Browse Source

0.8.1030007

pull/1615/head
Patrick Amrhein 9 months ago
parent
commit
139baf680a
  1. 16
      src/config/settings.h
  2. 2
      src/defines.h
  3. 6
      src/web/RestApi.h
  4. 17
      src/web/html/setup.html
  5. 17
      src/web/lang.json

16
src/config/settings.h

@ -210,6 +210,7 @@ typedef struct {
#define ZEROEXPORT_GROUP_MAX_LEN_PM_JSONPATH 100
#define ZEROEXPORT_GROUP_MAX_LEN_PM_USER 25
#define ZEROEXPORT_GROUP_MAX_LEN_PM_PASS 25
#define ZEROEXPORT_GROUP_MAX_LEN_BATTERY_SOC 100
#define ZEROEXPORT_GROUP_MAX_INVERTERS 3
#define ZEROEXPORT_POWERMETER_MAX_ERRORS 5
#define ZEROEXPORT_DEF_INV_WAITINGTIME_MS 10000
@ -290,9 +291,10 @@ typedef struct {
bool battEnabled;
float battVoltageOn;
float battVoltageOff;
char battSoC[ZEROEXPORT_GROUP_MAX_LEN_BATTERY_SOC];
// Advanced
int16_t setPoint;
uint8_t refresh;
bool minimum;
float power;
uint8_t powerTolerance;
uint16_t powerMax;
@ -688,9 +690,10 @@ class settings {
mCfg.plugin.zeroExport.groups[group].battEnabled = false;
mCfg.plugin.zeroExport.groups[group].battVoltageOn = 0;
mCfg.plugin.zeroExport.groups[group].battVoltageOff = 0;
snprintf(mCfg.plugin.zeroExport.groups[group].battSoC, ZEROEXPORT_GROUP_MAX_LEN_BATTERY_SOC, "%s", DEF_ZEXPORT);
// Advanced
mCfg.plugin.zeroExport.groups[group].setPoint = 0;
mCfg.plugin.zeroExport.groups[group].refresh = 10;
mCfg.plugin.zeroExport.groups[group].minimum = true;
mCfg.plugin.zeroExport.groups[group].powerTolerance = 10;
mCfg.plugin.zeroExport.groups[group].powerMax = 600;
mCfg.plugin.zeroExport.groups[group].Kp = -1;
@ -1034,9 +1037,10 @@ class settings {
obj[F("battEnabled")] = mCfg.plugin.zeroExport.groups[group].battEnabled;
obj[F("battVoltageOn")] = mCfg.plugin.zeroExport.groups[group].battVoltageOn;
obj[F("battVoltageOff")] = mCfg.plugin.zeroExport.groups[group].battVoltageOff;
obj[F("battSoC")] = mCfg.plugin.zeroExport.groups[group].battSoC;
// Advanced
obj[F("setPoint")] = mCfg.plugin.zeroExport.groups[group].setPoint;
obj[F("refresh")] = mCfg.plugin.zeroExport.groups[group].refresh;
obj[F("minimum")] = mCfg.plugin.zeroExport.groups[group].minimum;
obj[F("powerTolerance")] = mCfg.plugin.zeroExport.groups[group].powerTolerance;
obj[F("powerMax")] = mCfg.plugin.zeroExport.groups[group].powerMax;
obj[F("Kp")] = mCfg.plugin.zeroExport.groups[group].Kp;
@ -1072,11 +1076,13 @@ class settings {
getVal<float>(obj, F("battVoltageOn"), &mCfg.plugin.zeroExport.groups[group].battVoltageOn);
if (obj.containsKey(F("battVoltageOff")))
getVal<float>(obj, F("battVoltageOff"), &mCfg.plugin.zeroExport.groups[group].battVoltageOff);
if (obj.containsKey(F("battSoC")))
getChar(obj, F("battSoC"), mCfg.plugin.zeroExport.groups[group].battSoC, ZEROEXPORT_GROUP_MAX_LEN_BATTERY_SOC);
// Advanced
if (obj.containsKey(F("setPoint")))
getVal<int16_t>(obj, F("setPoint"), &mCfg.plugin.zeroExport.groups[group].setPoint);
if (obj.containsKey(F("refresh")))
getVal<uint8_t>(obj, F("refresh"), &mCfg.plugin.zeroExport.groups[group].refresh);
if (obj.containsKey(F("minimum")))
getVal<bool>(obj, F("minimum"), &mCfg.plugin.zeroExport.groups[group].minimum);
if (obj.containsKey(F("powerTolerance")))
getVal<uint8_t>(obj, F("powerTolerance"), &mCfg.plugin.zeroExport.groups[group].powerTolerance);
if (obj.containsKey(F("powerMax")))

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 1030006
#define VERSION_PATCH 1030007
//-------------------------------------
typedef struct {
uint8_t ch;

6
src/web/RestApi.h

@ -857,9 +857,10 @@ class RestApi {
objGroup[F("battEnabled")] = (bool)mConfig->plugin.zeroExport.groups[group].battEnabled;
objGroup[F("battVoltageOn")] = ah::round1((float)mConfig->plugin.zeroExport.groups[group].battVoltageOn);
objGroup[F("battVoltageOff")] = ah::round1((float)mConfig->plugin.zeroExport.groups[group].battVoltageOff);
objGroup[F("battSoC")] = String(mConfig->plugin.zeroExport.groups[group].battSoC);
// Advanced
objGroup[F("setPoint")] = (int16_t)mConfig->plugin.zeroExport.groups[group].setPoint;
objGroup[F("refresh")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].refresh;
objGroup[F("minimum")] = (bool)mConfig->plugin.zeroExport.groups[group].minimum;
objGroup[F("power")] = (int32_t)mConfig->plugin.zeroExport.groups[group].power;
objGroup[F("powerTolerance")] = (uint8_t)mConfig->plugin.zeroExport.groups[group].powerTolerance;
objGroup[F("powerMax")] = (uint16_t)mConfig->plugin.zeroExport.groups[group].powerMax;
@ -1171,9 +1172,10 @@ class RestApi {
mConfig->plugin.zeroExport.groups[group].battEnabled = jsonIn[F("battEnabled")];
mConfig->plugin.zeroExport.groups[group].battVoltageOn = jsonIn[F("battVoltageOn")];
mConfig->plugin.zeroExport.groups[group].battVoltageOff = jsonIn[F("battVoltageOff")];
snprintf(mConfig->plugin.zeroExport.groups[group].battSoC, ZEROEXPORT_GROUP_MAX_LEN_BATTERY_SOC, "%s", jsonIn[F("battSoC")].as<const char*>());
// Advanced
mConfig->plugin.zeroExport.groups[group].setPoint = jsonIn[F("setPoint")];
mConfig->plugin.zeroExport.groups[group].refresh = jsonIn[F("refresh")];
mConfig->plugin.zeroExport.groups[group].minimum = jsonIn[F("minimum")];
mConfig->plugin.zeroExport.groups[group].powerTolerance = jsonIn[F("powerTolerance")];
mConfig->plugin.zeroExport.groups[group].powerMax = jsonIn[F("powerMax")];
mConfig->plugin.zeroExport.groups[group].Kp = jsonIn[F("Kp")];

17
src/web/html/setup.html

@ -1362,6 +1362,8 @@
cb_battEnabled.checked = (obj.battEnabled);
// Tab_Advanced
var cb_minimum = ml("input", {name: "minimum", type: "checkbox"}, null);
cb_minimum.checked = (obj.minimum);
// Tab
var html = ml("div", {}, [
@ -1421,9 +1423,10 @@
]),
// Battery
ml("div", {id: "div{#ZE_GROUP_TAB_BATTERY}", class: "tab-content hide"}, [
divRow("{#ZE_GROUP_TAB_BATTERY_BATTENABLED}", cb_battEnabled),
divRow("{#ZE_GROUP_TAB_BATTERY_BATTVOLTAGEON}", ml("input", {name: "battVoltageOn", class: "text", type: "number", min: "0", max: "100", step: "0.1", value: obj.battVoltageOn}, null)),
divRow("{#ZE_GROUP_TAB_BATTERY_BATTVOLTAGEOFF}", ml("input", {name: "battVoltageOff", class: "text", type: "number", min: "0", max: "100", step: "0.1", value: obj.battVoltageOff}, null)),
divRow("{#ZE_GROUP_TAB_BATTERY_ENABLED}", cb_battEnabled),
divRow("{#ZE_GROUP_TAB_BATTERY_VOLTAGEON}", ml("input", {name: "battVoltageOn", class: "text", type: "number", min: "0", max: "100", step: "0.1", value: obj.battVoltageOn}, null)),
divRow("{#ZE_GROUP_TAB_BATTERY_VOLTAGEOFF}", ml("input", {name: "battVoltageOff", class: "text", type: "number", min: "0", max: "100", step: "0.1", value: obj.battVoltageOff}, null)),
divRow("{#ZE_GROUP_TAB_BATTERY_SOC}", ml("input", {name: "battSoC", class: "text", type: "text", value: obj.battSoC}, null)),
divRow("{#ZE_GROUP_TAB_BATTERY_ONOFF}", ml("input", {name: "battSwitch", id: "battSwitch", class: "btn", type: "button", value: "{#BTN_ONOFF}", onclick: battOnOff()}, null)),
// TODO: Uebersetzen mit lang.json und auf die entsprechende Dokuseite verlinken
divRow("Hinweis: ",
@ -1437,7 +1440,7 @@
// Advanced
ml("div", {id: "div{#ZE_GROUP_TAB_ADVANCED}", class: "tab-content hide"}, [
divRow("{#ZE_GROUP_TAB_ADVANCED_SETPOINT}", ml("input", {name: "setPoint", class: "text", type: "number", min: "-32768", max: "32767", step: "1", value: obj.setPoint}, null)),
divRow("{#ZE_GROUP_TAB_ADVANCED_REFRESH}", ml("input", {name: "refresh", class: "text", type: "number", min: "0", max: "255", value: obj.refresh}, null)),
divRow("{#ZE_GROUP_TAB_ADVANCED_MINIMUM}", cb_minimum),
divRow("{#ZE_GROUP_TAB_ADVANCED_POWERTOLERANCE}", ml("input", {name: "powerTolerance", class: "text", type: "number", min: "0", max: "255", value: obj.powerTolerance}, null)),
divRow("{#ZE_GROUP_TAB_ADVANCED_POWERMAX}", ml("input", {name: "powerMax", class: "text", type: "number", min: "0", max: "65535", value: obj.powerMax}, null)),
divRow("{#ZE_GROUP_TAB_ADVANCED_KP}", ml("input", {name: "Kp", class: "text", type: "number", min: "-1", max: "0", step: "0.001", value: obj.Kp}, null)),
@ -1563,9 +1566,10 @@
o.battEnabled = document.getElementsByName("battEnabled")[0].checked;
o.battVoltageOn = document.getElementsByName("battVoltageOn")[0].value;
o.battVoltageOff = document.getElementsByName("battVoltageOff")[0].value;
o.battSoC = document.getElementsByName("battSoC")[0].value;
// Advanced
o.setPoint = document.getElementsByName("setPoint")[0].value;
o.refresh = document.getElementsByName("refresh")[0].value;
o.minimum = document.getElementsByName("minimum")[0].checked;
o.powerTolerance = document.getElementsByName("powerTolerance")[0].value;
o.powerMax = document.getElementsByName("powerMax")[0].value;
o.Kp = document.getElementsByName("Kp")[0].value;
@ -1626,9 +1630,10 @@
o.battEnabled = false;
o.battVoltageOn = 0;
o.battVoltageOff = 0;
o.battSoC = "";
// Advanced
o.setPoint = 0;
o.refresh = 10;
o.minimum = true;
o.power = 0;
o.powerTolerance = 10;
o.powerMax = 600;

17
src/web/lang.json

@ -944,20 +944,25 @@
"de": "Batterie"
},
{
"token": "ZE_GROUP_TAB_BATTERY_BATTENABLED",
"token": "ZE_GROUP_TAB_BATTERY_ENABLED",
"en": "Enabled:",
"de": "Aktiviert:"
},
{
"token": "ZE_GROUP_TAB_BATTERY_BATTVOLTAGEON",
"token": "ZE_GROUP_TAB_BATTERY_VOLTAGEON",
"en": "Voltage on (Volt):",
"de": "Spannung Ein (Volt):"
},
{
"token": "ZE_GROUP_TAB_BATTERY_BATTVOLTAGEOFF",
"token": "ZE_GROUP_TAB_BATTERY_VOLTAGEOFF",
"en": "Voltage off (Volt):",
"de": "Spannung Aus (Volt):"
},
{
"token": "ZE_GROUP_TAB_BATTERY_SOC",
"en": "SoC % (MQTT Topic):",
"de": "SoC (MQTT Topic):"
},
{
"token": "ZE_GROUP_TAB_BATTERY_ONOFF",
"en": "Power:",
@ -979,9 +984,9 @@
"de": "Zielpunkt (Watt):"
},
{
"token": "ZE_GROUP_TAB_ADVANCED_REFRESH",
"en": "Refresh rate (sec):",
"de": "Aktualisierung (sec):"
"token": "ZE_GROUP_TAB_ADVANCED_MINIMUM",
"en": "Minimum:",
"de": "Minimum (Grundlast):"
},
{
"token": "ZE_GROUP_TAB_ADVANCED_POWERTOLERANCE",

Loading…
Cancel
Save