Compare commits

..
4 Commits
6 changed files with 21 additions and 10 deletions
+3 -3
View File
@@ -39,7 +39,7 @@ Please let me know if your car works with this addon so I can expand the list!<b
- Sensor "Charging Connection Status" - Sensor "Charging Connection Status"
- Sensor "Estimated Charging Finish Time" - Sensor "Estimated Charging Finish Time"
- Sensor "Door Lock Status (All doors, tank lid, and engine hood)" - Sensor "Door Lock Status (All doors, tank lid, and engine hood)"
- Sensor "Window Lock Status (All windows and sunroof)" - Sensor "Window Lock Status (All windows and sunroof - Thanks to @navet)"
- Sensor "Engine Status" - Sensor "Engine Status"
- Sensor "Odometer" - Sensor "Odometer"
- Sensor "Tire Status" - Sensor "Tire Status"
@@ -57,7 +57,7 @@ NOTE: Energy status currently available only for cars in the Europe / Middle Eas
Just install this addon with the following command. Just install this addon with the following command.
Please note to fill in your settings inside the environment variables. Please note to fill in your settings inside the environment variables.
`docker run -d --pull=always -e CONF_updateInterval=300 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "", "username": "", "password": "", "port": 1883}' -e CONF_volvoData='@json {"username": "", "password": "", "vin": "", "vccapikey": "", "odometerMultiplier": 1}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest` `docker run -d --pull=always -e CONF_updateInterval=300 -e CONF_babelLocale='de' -e CONF_mqtt='@json {"broker": "", "username": "", "password": "", "port": 1883}' -e CONF_volvoData='@json {"username": "", "password": "", "vin": "", "vccapikey": "", "odometerMultiplier": 1, "averageSpeedDivider": 1}' -e TZ='Europe/Berlin' --name volvo2mqtt ghcr.io/dielee/volvo2mqtt:latest`
<b>HA Add-On:</b><br> <b>HA Add-On:</b><br>
@@ -70,7 +70,7 @@ Here is what every option means:
| `CONF_updateInterval` | `int` | **required** | Update intervall in seconds. | | `CONF_updateInterval` | `int` | **required** | Update intervall in seconds. |
| `CONF_babelLocale` | `string` | **required** | Select your country from this [list](https://www.ibm.com/docs/en/radfws/9.7?topic=overview-locales-code-pages-supported). "Locale name" is the column you need! | | `CONF_babelLocale` | `string` | **required** | Select your country from this [list](https://www.ibm.com/docs/en/radfws/9.7?topic=overview-locales-code-pages-supported). "Locale name" is the column you need! |
| `CONF_mqtt` | `json` | **required** | Broker = Mqtt Broker IP / Username and Passwort are optional! Broker port can be changed. If no value is given, port 1883 will be used. | | `CONF_mqtt` | `json` | **required** | Broker = Mqtt Broker IP / Username and Passwort are optional! Broker port can be changed. If no value is given, port 1883 will be used. |
| `CONF_volvoData` | `json` | **required** | Username and password are REQUIRED. Car vin can be a single vin or a list of multiple vins like `["vin1", "vin2"]`. If no vin is provided, <b>ALL</b> of your vehicles will be used. Vccapi key is REQUIRED. Get your Vccapi key from [here](https://developer.volvocars.com/account/). Odometer Multiplier is sometimes 10, sometimes 1. Try what's right for your car. If you leave it empty, the multiplier will be 1. | | `CONF_volvoData` | `json` | **required** | Username and password are REQUIRED. Car vin can be a single vin or a list of multiple vins like `["vin1", "vin2"]`. If no vin is provided, <b>ALL</b> of your vehicles will be used. Vccapi key is REQUIRED. Get your Vccapi key from [here](https://developer.volvocars.com/account/). Odometer Multiplier is sometimes 10, sometimes 1. The same is applicable for average speed divider. Try what's right for your car. If you leave it empty, the multiplier and divider will be 1. |
| `CONF_debug` | `string` | | Debug option (true/false) - optional! | | `CONF_debug` | `string` | | Debug option (true/false) - optional! |
| `TZ` | `string` | | Container timezone eg "Europe/Berlin" from [here](https://docs.diladele.com/docker/timezones.html)| | `TZ` | `string` | | Container timezone eg "Europe/Berlin" from [here](https://docs.diladele.com/docker/timezones.html)|
+3 -1
View File
@@ -1,6 +1,6 @@
name: "Volvo2Mqtt" name: "Volvo2Mqtt"
description: "Volvo AAOS MQTT bridge" description: "Volvo AAOS MQTT bridge"
version: "1.5.3" version: "1.5.5"
slug: "volvo2mqtt" slug: "volvo2mqtt"
init: false init: false
url: "https://github.com/Dielee/volvo2mqtt" url: "https://github.com/Dielee/volvo2mqtt"
@@ -21,6 +21,7 @@ options:
vin: "" vin: ""
vccapikey: null vccapikey: null
odometerMultiplier: 1 odometerMultiplier: 1
averageSpeedDivider: 1
schema: schema:
updateInterval: int(10,) updateInterval: int(10,)
babelLocale: str babelLocale: str
@@ -37,6 +38,7 @@ schema:
vin: str? vin: str?
vccapikey: str vccapikey: str
odometerMultiplier: int(1,) odometerMultiplier: int(1,)
averageSpeedDivider: int(1,)
arch: arch:
- aarch64 - aarch64
- amd64 - amd64
+2 -2
View File
@@ -1,6 +1,6 @@
from config import settings from config import settings
VERSION = "v1.5.3" VERSION = "v1.5.5"
OAUTH_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2" OAUTH_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2"
VEHICLES_URL = "https://api.volvocars.com/connected-vehicle/v1/vehicles" VEHICLES_URL = "https://api.volvocars.com/connected-vehicle/v1/vehicles"
@@ -52,7 +52,7 @@ supported_entities = [
{"name": "Tailgate", "domain": "binary_sensor", "device_class": "door", "id": "tailgate", "icon": "car-door-lock", "url": LOCK_STATE_URL}, {"name": "Tailgate", "domain": "binary_sensor", "device_class": "door", "id": "tailgate", "icon": "car-door-lock", "url": LOCK_STATE_URL},
{"name": "Engine Hood", "domain": "binary_sensor", "device_class": "door", "id": "engine_hood", "icon": "car-door-lock", "url": LOCK_STATE_URL}, {"name": "Engine Hood", "domain": "binary_sensor", "device_class": "door", "id": "engine_hood", "icon": "car-door-lock", "url": LOCK_STATE_URL},
{"name": "Tank Lid", "domain": "binary_sensor", "device_class": "door", "id": "tank_lid", "icon": "car-door-lock", "url": LOCK_STATE_URL}, {"name": "Tank Lid", "domain": "binary_sensor", "device_class": "door", "id": "tank_lid", "icon": "car-door-lock", "url": LOCK_STATE_URL},
{"name": "Sunroof", "domain": "binary_sensor", "device_class": "door", "id": "sunroof", "icon": "car-door-lock", "url": LOCK_STATE_URL}, {"name": "Sunroof", "domain": "binary_sensor", "device_class": "door", "id": "sunroof", "icon": "car-door-lock", "url": WINDOWS_STATE_URL},
{"name": "Air Conditioning", "domain": "switch", "id": "climate_status", "icon": "air-conditioner"}, {"name": "Air Conditioning", "domain": "switch", "id": "climate_status", "icon": "air-conditioner"},
{"name": "Lock state", "domain": "lock", "id": "lock_status", "icon": "lock", "url": LOCK_STATE_URL}, {"name": "Lock state", "domain": "lock", "id": "lock_status", "icon": "lock", "url": LOCK_STATE_URL},
{"name": "Force Update Data", "domain": "button", "id": "update_data", "icon": "update", "url": ""}, {"name": "Force Update Data", "domain": "button", "id": "update_data", "icon": "update", "url": ""},
+3 -1
View File
@@ -12,6 +12,8 @@
"username": "", "username": "",
"password": "", "password": "",
"vin": "", "vin": "",
"vccapikey": "" "vccapikey": "",
"odometerMultiplier": "",
"averageSpeedDivider": ""
} }
} }
+2 -2
View File
@@ -15,5 +15,5 @@ configuration:
name: MQTT Broker settings name: MQTT Broker settings
description: Broker is your mqtt broker IP eg "192.168.0.1". Mqtt username and password are optional. Broker port can be changed. If no value is given, port 1883 will be used. description: Broker is your mqtt broker IP eg "192.168.0.1". Mqtt username and password are optional. Broker port can be changed. If no value is given, port 1883 will be used.
volvoData: volvoData:
name: Volvo APP credentials name: Volvo configuration options
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! 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. The same is applicable for average speed divider. Leave it as it is if you don't know what's right. Take a look at the GitHub repo for more information!
+8 -1
View File
@@ -344,7 +344,14 @@ def parse_api_data(data, sensor_id=None):
if util.keys_exists(data, "averageSpeed"): if util.keys_exists(data, "averageSpeed"):
average_speed = int(data["averageSpeed"]["value"]) average_speed = int(data["averageSpeed"]["value"])
if average_speed > 0: if average_speed > 0:
return average_speed divider = 1
if util.keys_exists(settings["volvoData"], "averageSpeedDivider"):
divider = settings["volvoData"]["averageSpeedDivider"]
if isinstance(divider, str):
divider = 1
elif divider < 1:
divider = 1
return average_speed / divider
else: else:
return None return None
else: else: