Loadpoint: don't log expected errors (#26420)

This commit is contained in:
andig 2026-01-04 17:21:40 +01:00 • committed by GitHub
parent da7ec0ad45
commit 2b478a592f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 7 deletions

View file

@ -784,7 +784,7 @@ func (lp *Loadpoint) syncCharger() error {
lp.offeredCurrent = current
lp.bus.Publish(evChargeCurrent, lp.offeredCurrent)
}
} else if !errors.Is(err, api.ErrNotAvailable) {
} else if !loadpoint.AcceptableError(err) {
return fmt.Errorf("charger get max current: %w", err)
}
}
@ -1741,11 +1741,11 @@ func (lp *Loadpoint) publishSocAndRange() {
lp.log.DEBUG.Printf("charger soc limit: %d%%", limit)
// https://github.com/evcc-io/evcc/issues/13349
lp.publish(keys.VehicleLimitSoc, float64(limit))
} else if !errors.Is(err, api.ErrNotAvailable) {
} else if !loadpoint.AcceptableError(err) {
lp.log.ERROR.Printf("charger soc limit: %v", err)
}
}
} else if !errors.Is(err, api.ErrNotAvailable) {
} else if !loadpoint.AcceptableError(err) {
lp.log.ERROR.Printf("charger soc: %v", err)
}

View file

@ -1,6 +1,8 @@
package core
import (
"errors"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/core/keys"
"github.com/evcc-io/evcc/core/session"
@ -17,7 +19,9 @@ func (lp *Loadpoint) chargeMeterTotal() float64 {
f, err := m.TotalEnergy()
if err != nil {
lp.log.ERROR.Printf("charge total import: %v", err)
if !errors.Is(err, api.ErrNotAvailable) {
lp.log.ERROR.Printf("charge total import: %v", err)
}
return 0
}

View file

@ -7,6 +7,7 @@ import (
"github.com/benbjohnson/clock"
"github.com/evcc-io/evcc/api"
"github.com/evcc-io/evcc/core/loadpoint"
"github.com/evcc-io/evcc/util"
)
@ -52,7 +53,7 @@ func (cr *ChargeRater) StartCharge(continued bool) {
if f, err := m.TotalEnergy(); err == nil {
cr.startEnergy = f
cr.log.DEBUG.Printf("charge start energy: %.3fkWh", f)
} else {
} else if !loadpoint.AcceptableError(err) {
cr.log.ERROR.Printf("charge total import: %v", err)
}
}
@ -77,7 +78,7 @@ func (cr *ChargeRater) StopCharge() {
if f, err := m.TotalEnergy(); err == nil {
cr.chargedEnergy += f - cr.startEnergy
cr.log.DEBUG.Printf("charge final energy: %.3fkWh", cr.chargedEnergy)
} else {
} else if !loadpoint.AcceptableError(err) {
cr.log.ERROR.Printf("charge total import: %v", err)
}
}
@ -97,7 +98,7 @@ func (cr *ChargeRater) ResetCharge() {
cr.log.DEBUG.Printf("charge final energy: %.3fkWh", cr.chargedEnergy)
cr.startEnergy = f
} else {
} else if !loadpoint.AcceptableError(err) {
cr.log.ERROR.Printf("charge total import: %v", err)
}
}