|
|
|
@ -171,19 +171,20 @@ class PubMqttIvData { |
|
|
|
mTotal[3] += mIv->getValue(mPos, rec); |
|
|
|
break; |
|
|
|
} |
|
|
|
} else if (mIv->GeneralConfig->rstValsAtMidNight) { |
|
|
|
} 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, mPos); |
|
|
|
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, mPos); |
|
|
|
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); |
|
|
|
|