From 1eb635592dffe7457b98115546687a18a2c04e73 Mon Sep 17 00:00:00 2001 From: Linus Dietz <45101649+Dielee@users.noreply.github.com> Date: Tue, 20 Jun 2023 13:31:18 +0200 Subject: [PATCH] Fix charging system status --- src/const.py | 4 ++-- src/volvo.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/const.py b/src/const.py index 29b61a7..2009415 100644 --- a/src/const.py +++ b/src/const.py @@ -1,4 +1,4 @@ -VERSION = "v1.0.9" +VERSION = "v1.0.10" OAUTH_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2" VEHICLES_URL = "https://api.volvocars.com/connected-vehicle/v1/vehicles" @@ -12,7 +12,7 @@ CAR_UNLOCK_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/co RECHARGE_STATUS_URL = "https://api.volvocars.com/energy/v1/vehicles/{0}/recharge-status" charging_system_states = {"CHARGING_SYSTEM_CHARGING": "Charging", "CHARGING_SYSTEM_IDLE": "Idle", - "CHARGING_SYSTEM_FAULT": "Fault", "CHARGING_SYSTEM_UNSPECIFIED": "UNSPECIFIED"} + "CHARGING_SYSTEM_FAULT": "Fault", "CHARGING_SYSTEM_UNSPECIFIED": "Unspecified"} supported_sensors = [ {"name": "Battery Charge Level", "id": "battery_charge_level", "unit": "%", "icon": "car-battery", "url": RECHARGE_STATUS_URL}, diff --git a/src/volvo.py b/src/volvo.py index 7579796..ecbf813 100644 --- a/src/volvo.py +++ b/src/volvo.py @@ -167,7 +167,7 @@ def parse_api_data(url, data, sensor_id=None): else: return "" elif sensor_id == "charging_system_status": - if "charging_system_status" in data["data"]: + if "chargingSystemStatus" in data["data"]: return charging_system_states[data["data"]["chargingSystemStatus"]["value"]] else: return ""