Browse Source

Merge df3504a2f8 into c4fe30f118

pull/1866/merge
wasilukm 2 weeks ago
committed by GitHub
parent
commit
a6354cfd44
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 24
      src/publisher/pubMqttIvData.h

24
src/publisher/pubMqttIvData.h

@ -171,8 +171,30 @@ class PubMqttIvData {
mTotal[3] += mIv->getValue(mPos, rec);
break;
}
} else
} else if (mIv->GeneralConfig->rstValsAtMidNight && rec->ts > 0) {
// Inverter is OFF - use last stored YT/YD values for total calculation.
// It is safe to use them when values are reset at midnight.
// Timestap check is to avoid wrong totals after restart (lower than before restart).
// This helps in having correct total values during daytime even when some inverters are OFF
switch (rec->assign[mPos].fieldId) {
case FLD_YT:
DPRINT_IVID(DBG_DEBUG, mIv->id);
DBGPRINT(F("Inverter is OFF - Using last YT: "));
DBGPRINTLN(String(mIv->getValue(mPos, rec)));
mTotal[1] += mIv->getValue(mPos, rec);
break;
case FLD_YD: {
DPRINT_IVID(DBG_DEBUG, mIv->id);
DBGPRINT(F("Inverter is OFF - Using last YD: "));
DBGPRINTLN(String(mIv->getValue(mPos, rec)));
mTotal[2] += mIv->getValue(mPos, rec);
break;
}
}
}
else {
mAllTotalFound = false;
}
}
}

Loading…
Cancel
Save