Add stop charge api
This commit is contained in:
parent
e3dd38f6d5
commit
2464bffd2f
2 changed files with 12 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue