Skip to content

Commit

Permalink
Porsche: accept inprocess as paired
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 1, 2022
1 parent c308530 commit 887394f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vehicle/porsche.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewPorscheFromConfig(other map[string]interface{}) (api.Vehicle, error) {
}

// check if vehicle is paired
if res, err := api.PairingStatus(cc.VIN); err == nil && res.Status != porsche.PairingComplete {
if res, err := api.PairingStatus(cc.VIN); err == nil && !porsche.IsPaired(res.Status) {
return nil, errors.New("vehicle is not paired with the My Porsche account")
}

Expand Down
7 changes: 6 additions & 1 deletion vehicle/porsche/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import (
const (
ApiURI = "https://api.porsche.com"

PairingComplete = "PAIRINGCOMPLETE"
PairingComplete = "PAIRINGCOMPLETE"
PairingInProcess = "INPROCESS"
)

func IsPaired(status string) bool {
return status == PairingComplete || status == PairingInProcess
}

// API is an api.Vehicle implementation for Porsche PHEV cars
type API struct {
*request.Helper
Expand Down

0 comments on commit 887394f

Please sign in to comment.