Add stop charge api

This commit is contained in:
andig 2021-05-08 11:48:38 +02:00
parent e3dd38f6d5
commit 2464bffd2f
2 changed files with 12 additions and 0 deletions

View file

@ -118,3 +118,8 @@ type VehicleClimater interface {
type VehicleStartCharge interface {
StartCharge() error
}
// VehicleStopCharge stops the charging session on the vehicle side
type VehicleStopCharge interface {
StopCharge() error
}

View file

@ -466,6 +466,13 @@ func (lp *LoadPoint) setLimit(chargeCurrent float64, force bool) (err error) {
return nil
}
// sleep vehicle
if car, ok := lp.vehicle.(api.VehicleStopCharge); !enabled && ok {
if err := car.StopCharge(); err != nil {
lp.log.ERROR.Printf("vehicle remote charge stop: %v", err)
}
}
lp.log.DEBUG.Printf("charger %s", status[enabled])
if err = lp.charger.Enable(enabled); err == nil {
lp.enabled = enabled