Loadpoint: ignore implausible charge rater readings (#32174)

This commit is contained in:
andig 2026-07-26 15:16:06 +02:00 • committed by GitHub
parent 300892d1ff
commit 1f3196b105
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -56,6 +56,8 @@ const (
minActiveCurrent = 1.0 // minimum current at which a phase is treated as active
minActiveVoltage = 207 // minimum voltage at which a phase is treated as active
maxSessionEnergy = 1e3 // kWh, above this a charge rater reading is treated as garbage
chargerSwitchDuration = 60 * time.Second // allow out of sync during this timespan
phaseSwitchDuration = 60 * time.Second // allow out of sync and do not measure phases during this timespan
@ -1811,8 +1813,14 @@ func (lp *Loadpoint) publishChargeProgress() {
if f, err := lp.chargeRater.ChargedEnergy(); err == nil {
// workaround for Go-E resetting during disconnect, see
// https://github.com/evcc-io/evcc/issues/5092
if f > lp.chargedAtStartup {
added, addedGreen := lp.energyMetrics.Update(f - lp.chargedAtStartup)
switch session := f - lp.chargedAtStartup; {
case session > maxSessionEnergy:
// guard against meters reporting register garbage, see
// https://github.com/evcc-io/evcc/issues/32159
lp.log.WARN.Printf("ignoring implausible session energy: %.3fkWh", session)
case session > 0:
added, addedGreen := lp.energyMetrics.Update(session)
if added > 0 {
lp.log.DEBUG.Printf("session energy: %.3fkWh", f)
}