You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(deye): source energy counters from the Daily registers
DEYE_ENERGY_KEYS mapped Predbat's *_today args onto the lifetime "Total*"
accumulators. Those are firmware-derived and drift: on a live capture
TotalConsumption read 14332.40 kWh where the other lifetime counters implied
15475.00 (buy 13579.20 + PV 2208.30 - sell 11.80 + discharge 5255.90 -
charge 5556.60), a 7.4% shortfall. That fed straight into Predbat's learned
load, so load_today climbed slower than the house actually consumed and every
charge window came out under-sized.
The Daily registers balance exactly on the same payload
(DailyConsumption 12.80 = DailyActiveProduction 4.50 + DailyEnergyPurchased
7.00 - DailyGridFeedIn 0.00 + DailyDischargingEnergy 4.10 -
DailyChargingEnergy 2.80), so all four counters now read from them.
The old comment claimed daily counters were unusable because Predbat needs an
incrementing series and a midnight reset would read as a large negative delta.
That is not the case: minute_data() smooths the near-midnight drop and
clean_incrementing_reverse() re-bases on any reset to <= 0, so the nightly
return to 0.00 is absorbed. Comment corrected rather than left to mislead.
Tests: energy counters now assert the Daily values, plus a new test pinning
the daily energy balance so a drifted key spelling breaks the sum - the same
failure that hid the original bug.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments