Repository navigation
Add Renault odometer #3254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Renault odometer #3254
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,5 +81,18 @@ def fetch_soc(config: RenaultConfiguration) -> CarState: | |
| responsetext = response.read() | ||
| batt = json.loads(responsetext) | ||
|
|
||
| # Step 9 - cockpit data for odometer/totalMileage | ||
| data = urllib.parse.urlencode(country_data) | ||
| data = data.encode('Big5') | ||
| reg = urllib.request.Request(KAMEREON_ROOTURL + '/commerce/v1/accounts/' + | ||
| kamereonaccountid + '/kamereon/kca/car-adapter/v1/cars/' | ||
| + vin + '/cockpit?' + data.decode("utf-8")) | ||
| reg.add_header('x-gigya-id_token', gigya_jwttoken) | ||
| reg.add_header('apikey', KAMEREON_API_KEY) | ||
| response = urllib.request.urlopen(reg) | ||
| responsetext = response.read() | ||
| cockpit = json.loads(responsetext) | ||
|
seaspotter marked this conversation as resolved.
Resolved
|
||
|
|
||
| return CarState(soc=float(batt['data']['attributes']['batteryLevel']), | ||
| range=float(batt['data']['attributes']['batteryAutonomy'])) | ||
| range=float(batt['data']['attributes']['batteryAutonomy']), | ||
| odometer=float(cockpit['data']['attributes']['totalMileage'])) | ||
|
seaspotter marked this conversation as resolved.
Resolved
Comment on lines
+84
to
+98
|
||
Uh oh!
There was an error while loading. Please reload this page.