From 1635db48b6146aeedff2251b27a2fbaf3c49a7fd Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Sun, 7 Apr 2024 20:29:26 +0200 Subject: [PATCH 1/7] Update getPowermeterWattsMqtt --- src/web/html/setup.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/html/setup.html b/src/web/html/setup.html index 1463757b..0c7b2e92 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -1469,7 +1469,7 @@ e.appendChild(opt("0", "---")); e.appendChild(opt("1", "Shelly")); //e.appendChild(opt("2", "Tasmota")); - //e.appendChild(opt("3", "Mqtt")); + e.appendChild(opt("3", "Mqtt")); //e.appendChild(opt("4", "Hichi")); e.appendChild(opt("5", "Tibber")); e.appendChild(opt("6", "Shrdzm")); From e18309a528c15ad2715efd8cff7d1dec07686f4a Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Sun, 7 Apr 2024 20:31:43 +0200 Subject: [PATCH 2/7] Update zeroExport.h --- src/plugins/zeroExport/zeroExport.h | 164 ++++++++++++++-------------- 1 file changed, 84 insertions(+), 80 deletions(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index 9f0f8ca9..64619d22 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -68,14 +68,14 @@ class ZeroExport { if ((!mIsInitialized) || (!mCfg->enabled)) return; - bool DoLog = false; + bool DoLog = false; // false state ? unsigned long Tsp = millis(); mPowermeter.loop(&Tsp, &DoLog); if (DoLog) sendLog(); clearLog(); - DoLog = false; + DoLog = false; // here again?? for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { zeroExportGroup_t *cfgGroup = &mCfg->groups[group]; @@ -139,7 +139,7 @@ class ZeroExport { cfgGroup->state = zeroExportState::CONTROLLER; #if defined(ZEROEXPORT_DEV_POWERMETER) cfgGroup->lastRefresh = millis(); - cfgGroup->state = zeroExportState::PUBLISH; + cfgGroup->state = zeroExportState::WAITREFRESH; #endif } else { cfgGroup->wait = 3000; @@ -264,8 +264,8 @@ class ZeroExport { if (!mIsInitialized) return; // Select all Inverter to reboot - for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { - for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { + for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { + for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { mCfg->groups[group].inverters[inv].doReboot = 1; } } @@ -472,12 +472,11 @@ class ZeroExport { */ void onMqttMessage(JsonObject obj) { if (!mIsInitialized) return; + mLog["t"] = "onMqttMessage"; String topic = String(obj["topic"]); if (!topic.indexOf("/zero/set/")) return; - mLog["t"] = "onMqttMessage"; - if (obj["path"] == "zero" && obj["cmd"] == "set") { int8_t topicGroup = getGroupFromTopic(topic.c_str()); mLog["topicGroup"] = topicGroup; @@ -520,11 +519,11 @@ class ZeroExport { } // "topic":"???/zero/set/groups/0/advanced/setPoint" if (topic.indexOf("advanced/setPoint") != -1) { - mCfg->groups[topicGroup].setPoint = (int32_t)obj["val"]; + mCfg->groups[topicGroup].setPoint = (int16_t)obj["val"]; } // "topic":"???/zero/set/groups/0/advanced/powerTolerance" if (topic.indexOf("advanced/powerTolerance") != -1) { - mCfg->groups[topicGroup].powerTolerance = (uint16_t)obj["val"]; + mCfg->groups[topicGroup].powerTolerance = (uint8_t)obj["val"]; } // "topic":"???/zero/set/groups/0/advanced/powerMax" if (topic.indexOf("advanced/powerMax") != -1) { @@ -546,6 +545,17 @@ class ZeroExport { } } + // topic for powermeter? + for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) + { + if(mCfg->groups[group].pm_type == zeroExportPowermeterType_t::Mqtt) + { + mLog["mqttDevice"] = "topicInverter"; + if(!topic.equals(mCfg->groups[group].pm_jsonPath)) return; + mCfg->groups[group].power = (int32_t)obj["val"]; + } + } + if (mCfg->debug) mLog["Msg"] = obj; sendLog(); clearLog(); @@ -829,10 +839,8 @@ class ZeroExport { mCfg->groups[group].pm_P3 = mPowermeter.getDataAVG(group).P3; if ( - (mCfg->groups[group].pm_P == 0) && - (mCfg->groups[group].pm_P1 == 0) && - (mCfg->groups[group].pm_P2 == 0) && - (mCfg->groups[group].pm_P3 == 0)) { + (mCfg->groups[group].pm_P == 0) && (mCfg->groups[group].pm_P1 == 0) && + (mCfg->groups[group].pm_P2 == 0) && (mCfg->groups[group].pm_P3 == 0)) { return false; } @@ -842,12 +850,17 @@ class ZeroExport { mLog["P3"] = mCfg->groups[group].pm_P3; // MQTT - Powermeter - mqttObj["Sum"] = mCfg->groups[group].pm_P; - mqttObj["L1"] = mCfg->groups[group].pm_P1; - mqttObj["L2"] = mCfg->groups[group].pm_P2; - mqttObj["L3"] = mCfg->groups[group].pm_P3; - mMqtt->publish("zero/state/powermeter/P", mqttDoc.as().c_str(), false); - mqttDoc.clear(); + if(mMqtt->isConnected()) + { + mqttObj["Sum"] = mCfg->groups[group].pm_P; + mqttObj["L1"] = mCfg->groups[group].pm_P1; + mqttObj["L2"] = mCfg->groups[group].pm_P2; + mqttObj["L3"] = mCfg->groups[group].pm_P3; + mMqtt->publish("zero/state/powermeter/P", mqttDoc.as().c_str(), false); + mqttDoc.clear(); + } + + // if (cfgGroup->pm_Publish_W) { // cfgGroup->pm_Publish_W = false; @@ -1229,7 +1242,7 @@ class ZeroExport { if ((cfgGroupInv->doReboot == 2) && (cfgGroupInv->waitAckSetReboot == 0)) { cfgGroupInv->doReboot = -1; if (mCfg->debug) { - logObj["act"] = "done"; + logObj["act"] = "nothing to do"; *doLog = true; } continue; @@ -1504,19 +1517,39 @@ class ZeroExport { obj["cmd"] = "limit_nonpersistent_absolute"; mApi->ctrlRequest(obj); + // publish to mqtt when mqtt + if(mMqtt->isConnected()) //@TODO: check if isConnected the correct way, or better bool from settings? + { + String gr = "zero/state/groups/" + String(group) + "/inverters/" + String(inv); + mqttObj["enabled"] = cfgGroupInv->enabled; + mqttObj["id"] = cfgGroupInv->id; + mqttObj["target"] = cfgGroupInv->target; + mqttObj["powerMin"] = cfgGroupInv->powerMin; + mqttObj["powerMax"] = cfgGroupInv->powerMax; + mMqtt->publish(gr.c_str(), mqttDoc.as().c_str(), false); + mqttDoc.clear(); + } + if (mCfg->debug) logObj["d"] = obj; } return result; } - - /** - * - */ - void PubSubInit(String gr, String payload) { - mMqtt->publish(gr.c_str(), payload.c_str(), false); + /* mqttSubscribe + * when a MQTT Msg is needed to subscribe, then a publish is leading + */ + void mqttSubscribe(String gr, String payload) + { + mqttPublish(gr, payload); mMqtt->subscribe(gr.c_str(), QOS_2); } + /* PubInit + * when a MQTT Msg is needed to Publish, but not to subscribe. + */ + void mqttPublish(String gr, String payload, bool retain = false) + { + mMqtt->publish(gr.c_str(), payload.c_str(), retain); + } /** * @@ -1528,40 +1561,45 @@ class ZeroExport { mIsSubscribed = true; // Global (zeroExport) - mMqtt->publish("zero/set/enabled", ((mCfg->enabled) ? dict[STR_TRUE] : dict[STR_FALSE]), false); - mMqtt->subscribe("zero/set/enabled", QOS_2); + // TODO: Global wird fälschlicherweise hier je nach anzahl der aktivierten Gruppen bis zu 6x ausgeführt. + mqttSubscribe("zero/set/enabled", ((mCfg->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); - mMqtt->publish("zero/set/sleep", ((mCfg->sleep) ? dict[STR_TRUE] : dict[STR_FALSE]), false); - mMqtt->subscribe("zero/set/sleep", QOS_2); + // TODO: Global wird fälschlicherweise hier je nach anzahl der aktivierten Gruppen bis zu 6x ausgeführt. + mqttSubscribe("zero/set/sleep", ((mCfg->sleep) ? dict[STR_TRUE] : dict[STR_FALSE])); - // Gruppen String gr; for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { zeroExportGroup_t *cfgGroup = &mCfg->groups[group]; + if(!cfgGroup->enabled) continue; // exit here when group is disabled + gr = "zero/set/groups/" + String(group); // General - PubSubInit(gr + "/enabled", ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); - PubSubInit(gr + "/sleep", ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttSubscribe(gr + "/enabled", ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttSubscribe(gr + "/sleep", ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); // Powermeter - // Inverters + // Inverters - Only Publish for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { zeroExportGroupInverter_t *cfgGroupInv = &cfgGroup->inverters[inv]; - PubSubInit(gr + "/inverters/" + String(inv) + "/enabled", ((cfgGroupInv->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); - PubSubInit(gr + "/inverters/" + String(inv) + "/powerMin", String(cfgGroupInv->powerMin)); - PubSubInit(gr + "/inverters/" + String(inv) + "/powerMax", String(cfgGroupInv->powerMax)); + mqttSubscribe(gr + "/inverters/" + String(inv) + "/enabled", ((cfgGroupInv->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttSubscribe(gr + "/inverters/" + String(inv) + "/powerMin", String(cfgGroupInv->powerMin)); + mqttSubscribe(gr + "/inverters/" + String(inv) + "/powerMax", String(cfgGroupInv->powerMax)); } // Battery - PubSubInit(gr + "/battery/switch", ((cfgGroup->battSwitch) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttSubscribe(gr + "/battery/switch", ((cfgGroup->battSwitch) ? dict[STR_TRUE] : dict[STR_FALSE])); // Advanced - PubSubInit(gr + "/advanced/setPoint", String(cfgGroup->setPoint)); - PubSubInit(gr + "/advanced/powerTolerance", String(cfgGroup->powerTolerance)); - PubSubInit(gr + "/advanced/powerMax", String(cfgGroup->powerMax)); + mqttSubscribe(gr + "/advanced/setPoint", String(cfgGroup->setPoint)); + mqttSubscribe(gr + "/advanced/powerTolerance", String(cfgGroup->powerTolerance)); + mqttSubscribe(gr + "/advanced/powerMax", String(cfgGroup->powerMax)); + mqttSubscribe(gr + "/advanced/refresh", String(cfgGroup->refresh)); + mqttSubscribe(gr + "/advanced/Kp", String(cfgGroup->Kp)); + mqttSubscribe(gr + "/advanced/Ki", String(cfgGroup->Ki)); + mqttSubscribe(gr + "/advanced/Kd", String(cfgGroup->Kd)); } } @@ -1580,54 +1618,20 @@ class ZeroExport { String gr; // Global (zeroExport) - // TODO: Global wird fälschlicherweise hier je nach anzahl der aktivierten Gruppen bis zu 6x ausgeführt. - mMqtt->publish("zero/state/enabled", ((mCfg->enabled) ? dict[STR_TRUE] : dict[STR_FALSE]), false); - // TODO: Global wird fälschlicherweise hier je nach anzahl der aktivierten Gruppen bis zu 6x ausgeführt. - mMqtt->publish("zero/state/sleep", ((mCfg->sleep) ? dict[STR_TRUE] : dict[STR_FALSE]), false); + mqttSubscribe("zero/set/enabled", ((mCfg->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttSubscribe("zero/set/sleep", ((mCfg->sleep) ? dict[STR_TRUE] : dict[STR_FALSE])); // General gr = "zero/state/groups/" + String(group) + "/enabled"; - mMqtt->publish(gr.c_str(), ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE]), false); + + mqttPublish(gr.c_str(), ((cfgGroup->enabled) ? dict[STR_TRUE] : dict[STR_FALSE])); + mqttPublish(gr.c_str(), ((cfgGroup->sleep) ? dict[STR_TRUE] : dict[STR_FALSE])); gr = "zero/state/groups/" + String(group) + "/sleep"; mMqtt->publish(gr.c_str(), ((cfgGroup->sleep) ? dict[STR_TRUE] : dict[STR_FALSE]), false); gr = "zero/state/groups/" + String(group) + "/name"; mMqtt->publish(gr.c_str(), cfgGroup->name, false); - - // Inverters - for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { - zeroExportGroupInverter_t *cfgGroupInv = &cfgGroup->inverters[inv]; - gr = "zero/state/groups/" + String(group) + "/inverters/" + String(inv); - mqttObj["enabled"] = cfgGroupInv->enabled; - mqttObj["id"] = cfgGroupInv->id; - mqttObj["target"] = cfgGroupInv->target; - mqttObj["powerMin"] = cfgGroupInv->powerMin; - mqttObj["powerMax"] = cfgGroupInv->powerMax; - mMqtt->publish(gr.c_str(), mqttDoc.as().c_str(), false); - mqttDoc.clear(); - } - - // Battery - gr = "zero/state/groups/" + String(group) + "/battery"; - mqttObj["enabled"] = cfgGroup->battEnabled; - mqttObj["voltageOn"] = cfgGroup->battVoltageOn; - mqttObj["voltageOff"] = cfgGroup->battVoltageOff; - mqttObj["switch"] = cfgGroup->battSwitch; - mMqtt->publish(gr.c_str(), mqttDoc.as().c_str(), false); - mqttDoc.clear(); - - // Advanced - gr = "zero/state/groups/" + String(group) + "/advanced"; - mqttObj["setPoint"] = cfgGroup->setPoint; - mqttObj["refresh"] = cfgGroup->refresh; - mqttObj["powerTolerance"] = cfgGroup->powerTolerance; - mqttObj["powerMax"] = cfgGroup->powerMax; - mqttObj["Kp"] = cfgGroup->Kp; - mqttObj["Ki"] = cfgGroup->Ki; - mqttObj["Kd"] = cfgGroup->Kd; - mMqtt->publish(gr.c_str(), mqttDoc.as().c_str(), false); - mqttDoc.clear(); } return true; From c91f2018cbfb6bf8a445fe5f88e853f33f4f1d5b Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Sun, 7 Apr 2024 20:32:30 +0200 Subject: [PATCH 3/7] Update powermeter.h --- src/plugins/zeroExport/powermeter.h | 37 +++++++++++------------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/plugins/zeroExport/powermeter.h b/src/plugins/zeroExport/powermeter.h index a44c89e3..4a365c20 100644 --- a/src/plugins/zeroExport/powermeter.h +++ b/src/plugins/zeroExport/powermeter.h @@ -117,6 +117,16 @@ class powermeter { } private: + HTTPClient http; + + zeroExport_t *mCfg; + JsonObject *mLog; + + unsigned long mPreviousTsp = 0; + + PowermeterBuffer_t mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0}; + short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0}; + // set HTTPClient header void setHeader(HTTPClient* h) { @@ -142,14 +152,7 @@ class powermeter { logObj["mod"] = "getPowermeterWattsShelly"; - HTTPClient http; - http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS); - http.setUserAgent("Ahoy-Agent"); - // TODO: Ahoy-0.8.850024-zero - http.setConnectTimeout(500); - http.setTimeout(1000); - http.addHeader("Content-Type", "application/json"); - http.addHeader("Accept", "application/json"); + setHeader(&http); String url = String("http://") + String(mCfg->groups[group].pm_url) + String("/") + String(mCfg->groups[group].pm_jsonPath); logObj["HTTP_URL"] = url; @@ -340,11 +343,9 @@ class powermeter { logObj["mod"] = "getPowermeterWattsMqtt"; - // Hier neuer Code - Anfang - - // TODO: Noch nicht komplett - - // Hier neuer Code - Ende + // topic for powermeter? + result.P = mCfg->groups[group].pm_P; + result.P1 = result.P2 = result.P3 = mCfg->groups[group].pm_P / 3; return result; } @@ -531,16 +532,6 @@ class powermeter { mPowermeterBufferPos[group]++; if (mPowermeterBufferPos[group] >= 5) mPowermeterBufferPos[group] = 0; } - - HTTPClient http; - - zeroExport_t *mCfg; - JsonObject *mLog; - - unsigned long mPreviousTsp = 0; - - PowermeterBuffer_t mPowermeterBuffer[ZEROEXPORT_MAX_GROUPS][5] = {0}; - short mPowermeterBufferPos[ZEROEXPORT_MAX_GROUPS] = {0}; }; #endif /*__POWERMETER_H__*/ From e7095bf398d0e295a71bdf7308f45a0fb1984f53 Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Sun, 7 Apr 2024 20:33:06 +0200 Subject: [PATCH 4/7] Update settings.h --- src/config/settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/settings.h b/src/config/settings.h index 7b3eac3d..7c93a1cb 100644 --- a/src/config/settings.h +++ b/src/config/settings.h @@ -216,7 +216,7 @@ typedef struct { #define ZEROEXPORT_GROUP_WR_LIMIT_MIN_DIFF 5 #define ZEROEXPORT_POWERMETER_SHELLY //#define ZEROEXPORT_POWERMETER_TASMOTA -//#define ZEROEXPORT_POWERMETER_MQTT +#define ZEROEXPORT_POWERMETER_MQTT //#define ZEROEXPORT_POWERMETER_HICHI #define ZEROEXPORT_POWERMETER_TIBBER #define ZEROEXPORT_POWERMETER_SHRDZM From dd79bd4d0d180a8f0b53b050289339cbece6bbfb Mon Sep 17 00:00:00 2001 From: DanielR92 Date: Mon, 8 Apr 2024 20:25:27 +0200 Subject: [PATCH 5/7] Update zeroExport.h Add mqttObj and remove some hints --- src/plugins/zeroExport/zeroExport.h | 38 +++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index 64619d22..05286fed 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -68,14 +68,14 @@ class ZeroExport { if ((!mIsInitialized) || (!mCfg->enabled)) return; - bool DoLog = false; // false state ? + bool DoLog = false; unsigned long Tsp = millis(); mPowermeter.loop(&Tsp, &DoLog); if (DoLog) sendLog(); clearLog(); - DoLog = false; // here again?? + DoLog = false; for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { zeroExportGroup_t *cfgGroup = &mCfg->groups[group]; @@ -263,9 +263,11 @@ class ZeroExport { void tickMidnight(void) { if (!mIsInitialized) return; - // Select all Inverter to reboot - for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { - for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { + // Select all Inverter to reboot + // shutdown for clean start environment + //@Todo: move to ahoy! + for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { + for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { mCfg->groups[group].inverters[inv].doReboot = 1; } } @@ -552,7 +554,7 @@ class ZeroExport { { mLog["mqttDevice"] = "topicInverter"; if(!topic.equals(mCfg->groups[group].pm_jsonPath)) return; - mCfg->groups[group].power = (int32_t)obj["val"]; + mCfg->groups[group].pm_P = (int32_t)obj["val"]; } } @@ -808,6 +810,14 @@ class ZeroExport { *doLog = true; } } + // Battery + String gr = "zero/state/groups/" + String(group) + "/battery"; + mqttObj["enabled"] = cfgGroup->battEnabled; + mqttObj["voltageOn"] = cfgGroup->battVoltageOn; + mqttObj["voltageOff"] = cfgGroup->battVoltageOff; + mqttObj["switch"] = cfgGroup->battSwitch; + mqttPublish(gr.c_str(), mqttDoc.as().c_str()); + mqttDoc.clear(); } else { mLog["en"] = false; @@ -1017,6 +1027,18 @@ class ZeroExport { return false; } + // Advanced + String gr = "zero/state/groups/" + String(group) + "/advanced"; + mqttObj["setPoint"] = cfgGroup->setPoint; + mqttObj["refresh"] = cfgGroup->refresh; + mqttObj["powerTolerance"] = cfgGroup->powerTolerance; + mqttObj["powerMax"] = cfgGroup->powerMax; + mqttObj["Kp"] = cfgGroup->Kp; + mqttObj["Ki"] = cfgGroup->Ki; + mqttObj["Kd"] = cfgGroup->Kd; + mqttPublish(gr.c_str(), mqttDoc.as().c_str()); + mqttDoc.clear(); + return true; } @@ -1242,7 +1264,7 @@ class ZeroExport { if ((cfgGroupInv->doReboot == 2) && (cfgGroupInv->waitAckSetReboot == 0)) { cfgGroupInv->doReboot = -1; if (mCfg->debug) { - logObj["act"] = "nothing to do"; + logObj["act"] = "done"; *doLog = true; } continue; @@ -1518,7 +1540,7 @@ class ZeroExport { mApi->ctrlRequest(obj); // publish to mqtt when mqtt - if(mMqtt->isConnected()) //@TODO: check if isConnected the correct way, or better bool from settings? + if(mMqtt->isConnected()) { String gr = "zero/state/groups/" + String(group) + "/inverters/" + String(inv); mqttObj["enabled"] = cfgGroupInv->enabled; From 5a0b095f071b9bce467db7d4fae9dc1f9bbcad75 Mon Sep 17 00:00:00 2001 From: tictrick <117273857+tictrick@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:21:02 +0200 Subject: [PATCH 6/7] Update zeroExport.h discard change --- src/plugins/zeroExport/zeroExport.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index ff961f05..83c8fad6 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -474,11 +474,12 @@ class ZeroExport { */ void onMqttMessage(JsonObject obj) { if (!mIsInitialized) return; - mLog["t"] = "onMqttMessage"; String topic = String(obj["topic"]); if (!topic.indexOf("/zero/set/")) return; + mLog["t"] = "onMqttMessage"; + if (obj["path"] == "zero" && obj["cmd"] == "set") { int8_t topicGroup = getGroupFromTopic(topic.c_str()); mLog["topicGroup"] = topicGroup; From 9a9ddb8c0ae0dce81bc6b5e8f6c5a15916c5a5fa Mon Sep 17 00:00:00 2001 From: tictrick <117273857+tictrick@users.noreply.github.com> Date: Tue, 9 Apr 2024 12:23:07 +0200 Subject: [PATCH 7/7] Update zeroExport.h format changes --- src/plugins/zeroExport/zeroExport.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index 83c8fad6..c62d3d89 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -255,6 +255,7 @@ class ZeroExport { /** tickerMidnight * Time pulse Midnicht + * Reboots Inverter at Midnight to reset YieldDay and clean start environment * @param void * @returns void * @todo Reboot der Inverter um Mitternacht in Ahoy selbst verschieben mit separater Config-Checkbox @@ -263,9 +264,6 @@ class ZeroExport { void tickMidnight(void) { if (!mIsInitialized) return; - // Select all Inverter to reboot - // shutdown for clean start environment - //@Todo: move to ahoy! for (uint8_t group = 0; group < ZEROEXPORT_MAX_GROUPS; group++) { for (uint8_t inv = 0; inv < ZEROEXPORT_GROUP_MAX_INVERTERS; inv++) { mCfg->groups[group].inverters[inv].doReboot = 1;