Browse Source

If PowerLimit already send, dont renew it.

pull/1155/head
DanielR92 2 years ago
parent
commit
2e50250dcd
  1. 11
      src/app.cpp
  2. 2
      src/plugins/zeroExport/zeroExport.h

11
src/app.cpp

@ -595,7 +595,11 @@ void app::updateLed(void) {
//-----------------------------------------------------------------------------
#if defined(ESP32)
void app::zeroexport() {
if (!mConfig->plugin.zexport.enabled) return; // check if plugin is enabled && indicate to send new value
if (!mConfig->plugin.zexport.enabled ||
!mSys.getInverterByPos(mConfig->plugin.zexport.Iv)->isProducing()) { // check if plugin is enabled && indicate to send new value
mConfig->plugin.zexport.lastTime = millis(); // set last timestamp
return;
}
if (millis() - mConfig->plugin.zexport.lastTime > mConfig->plugin.zexport.count_avg * 1000UL)
{
@ -613,6 +617,11 @@ void app::zeroexport() {
if(mConfig->plugin.zexport.max_power <= nValue)
nValue = mConfig->plugin.zexport.max_power;
if(iv->actPowerLimit == nValue) {
mConfig->plugin.zexport.lastTime = millis(); // set last timestamp
return; // if PowerLimit same as befor, then skip
}
object["val"] = nValue;
object["id"] = mConfig->plugin.zexport.Iv;
object["path"] = "ctrl";

2
src/plugins/zeroExport/zeroExport.h

@ -82,7 +82,7 @@ class ZeroExport {
responseBody = responseBody.substring(index); // cut it and store it in value
index = responseBody.indexOf(","); // find the first seperation - Bingo!?
mCfg->total_power = responseBody.substring(0, index - 1).toDouble();
mCfg->total_power = responseBody.substring(responseBody.indexOf(":"), index).toDouble();
} else if(json.containsKey(F("emeters"))) {
mCfg->total_power = (double)json[F("total_power")];
} else {

Loading…
Cancel
Save