Twc: wake-up vehicle if enable fails (#8684)

This commit is contained in:
andig 2023-06-29 11:04:53 +02:00 • committed by GitHub
parent 4d516d5844
commit e88c994fec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -693,6 +693,14 @@ func (lp *Loadpoint) setLimit(chargeCurrent float64, force bool) error {
lp.elapseGuard()
if err := lp.charger.Enable(enabled); err != nil {
v := lp.GetVehicle()
if vv, ok := v.(api.Resurrector); enabled && ok && errors.Is(err, api.ErrAsleep) {
// https://github.com/evcc-io/evcc/issues/8254
// wakeup vehicle
lp.log.DEBUG.Printf("charger %s: waking up vehicle", status[enabled])
return vv.WakeUp()
}
return fmt.Errorf("charger %s: %w", status[enabled], err)
}