Porsche: fix e-mobility vehicle API routes and add login error handling (#1552)

Change required as Porsche backend was updated
This commit is contained in:
Andreas Linde 2021-09-14 15:45:41 +02:00 • committed by GitHub
parent 43938a6230
commit ccf83bb310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -168,6 +168,9 @@ func (v *Identity) fetchToken(emobility bool) (tokenResponse, error) {
}
authCode := query.Get("code")
if authCode == "" {
return pr, errors.New("no auth code")
}
codeVerifier := CodeVerifier.CodeChallengePlain()

View file

@ -112,7 +112,7 @@ func (v *EMobilityProvider) request(uri string) (*http.Request, error) {
// Status implements the vehicle status response
func (v *EMobilityProvider) status(vin string) (interface{}, error) {
if v.carModel == "" {
uri := fmt.Sprintf("https://api.porsche.com/service-vehicle/vcs/capabilities/%s", vin)
uri := fmt.Sprintf("https://api.porsche.com/e-mobility/vcs/capabilities/%s", vin)
req, err := v.request(uri)
if err != nil {
return 0, err
@ -128,7 +128,7 @@ func (v *EMobilityProvider) status(vin string) (interface{}, error) {
v.carModel = cr.CarModel
}
uri := fmt.Sprintf("https://api.porsche.com/service-vehicle/de/de_DE/e-mobility/%s/%s?timezone=Europe/Berlin", v.carModel, vin)
uri := fmt.Sprintf("https://api.porsche.com/e-mobility/de/de_DE/%s/%s?timezone=Europe/Berlin", v.carModel, vin)
req, err := v.request(uri)
if err != nil {
return 0, err