Porsche: accept inprocess as paired

This commit is contained in:
andig 2022-07-01 17:22:35 +02:00
parent c30853089a
commit 887394fc0e
2 changed files with 7 additions and 2 deletions

View file

@ -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")
}

View file

@ -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