Skip to content

Commit

Permalink
Tesla: don't treat "completed" as error
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Sep 8, 2023
1 parent 8d49198 commit 191391f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vehicle/tesla.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package vehicle
import (
"context"
"errors"
"slices"
"time"

"github.com/bogosj/tesla"
Expand Down Expand Up @@ -213,7 +214,7 @@ var _ api.VehicleChargeController = (*Tesla)(nil)
// StartCharge implements the api.VehicleChargeController interface
func (v *Tesla) StartCharge() error {
err := v.apiError(v.vehicle.StartCharging())
if err != nil && err.Error() == "is_charging" {
if err != nil && slices.Contains([]string{"completed", "is_charging"}, err.Error()) {
return nil
}
return err
Expand Down

0 comments on commit 191391f

Please sign in to comment.