Skip to content

Commit

Permalink
Fix Renault api token expiry (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Jul 13, 2020
1 parent 2f2624b commit c270db1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vehicle/renault.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ func (v *Renault) chargeState() (float64, error) {
uri := fmt.Sprintf("%s/commerce/v1/accounts/%s/kamereon/kca/car-adapter/v1/cars/%s/battery-status", v.kamereon.Target, v.accountID, v.vin)
kr, err := v.kamereonRequest(uri)

// repeat auth if error
if err != nil {
if err = v.authFlow(); err == nil {
kr, err = v.kamereonRequest(uri)
}
}

return float64(kr.Data.Attributes.BatteryLevel), err
}

Expand Down

0 comments on commit c270db1

Please sign in to comment.