diff --git a/src/config.yaml b/src/config.yaml index 79da619..5f95e64 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -1,6 +1,6 @@ name: "Volvo2Mqtt" description: "Volvo AAOS MQTT bridge" -version: "1.3.1" +version: "1.3.2" slug: "volvo2mqtt" init: false url: "https://github.com/Dielee/volvo2mqtt" @@ -18,6 +18,7 @@ options: password: null vin: "" vccapikey: null + odometerMultiplier: 1 schema: updateInterval: int(10,) babelLocale: str @@ -31,6 +32,7 @@ schema: password: str vin: str? vccapikey: str + odometerMultiplier: int(1,) arch: - aarch64 - amd64 diff --git a/src/const.py b/src/const.py index 065707f..49cf37c 100644 --- a/src/const.py +++ b/src/const.py @@ -1,6 +1,6 @@ from config import settings -VERSION = "v1.3.1" +VERSION = "v1.3.2" OAUTH_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2" VEHICLES_URL = "https://api.volvocars.com/connected-vehicle/v1/vehicles" diff --git a/src/translations/en.yaml b/src/translations/en.yaml index 8c21424..355f53f 100644 --- a/src/translations/en.yaml +++ b/src/translations/en.yaml @@ -13,4 +13,4 @@ configuration: description: Broker is your mqtt broker IP eg "192.168.0.1". Mqtt username and password are optional. volvoData: name: Volvo APP credentials - description: You have to enter your Volvo app credentials. The username is normally your email, and the password is the password you use for your Volvo app. The vin can stay empty. The Add-On will use any vin inside your Volvo account. VCCAPI key is required and comes from your Volvo developer account. Take a look at the GitHub repo for more information! \ No newline at end of file + description: You have to enter your Volvo app credentials. The username is normally your email, and the password is the password you use for your Volvo app. The vin can stay empty. The Add-On will use any vin inside your Volvo account. VCCAPI key is required and comes from your Volvo developer account. Odometer multiplier is sometimes 10, sometimes 1. Leave it empty if you don't know what's right. Take a look at the GitHub repo for more information! \ No newline at end of file diff --git a/src/volvo.py b/src/volvo.py index 0129721..acc2094 100644 --- a/src/volvo.py +++ b/src/volvo.py @@ -331,7 +331,12 @@ def parse_api_data(data, sensor_id=None): elif sensor_id == "lock_status": return data["carLocked"]["value"] if keys_exists(data, "carLocked") else None elif sensor_id == "odometer": - return int(data["odometer"]["value"]) * 10 if keys_exists(data, "odometer") else None + multiplier = 1 + if keys_exists(settings["volvoData"], "odometerMultiplier"): + multiplier = settings["volvoData"]["odometerMultiplier"] + if multiplier < 1: + multiplier = 1 + return int(data["odometer"]["value"]) * multiplier if keys_exists(data, "odometer") else None elif sensor_id == "window_front_left": return data["frontLeftWindowOpen"]["value"] if keys_exists(data, "frontLeftWindowOpen") else None elif sensor_id == "window_front_right":