mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-08-12 18:59:53 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc7b711219 | ||
|
|
fb8c5ed269 | ||
|
|
a7dd6fac00 |
@@ -1,8 +1,19 @@
|
|||||||
|
## v1.7.9
|
||||||
|
### 🚀 Features:
|
||||||
|
|
||||||
|
- Added vehicle diagnostics sensors #75. Thanks to @aerrow5!
|
||||||
|
|
||||||
|
## v1.7.8
|
||||||
|
### 🐛 Bug Fixes:
|
||||||
|
|
||||||
|
- Fix "Estimated Charging Finish Time" Sensor
|
||||||
|
|
||||||
## v1.7.7
|
## v1.7.7
|
||||||
### 🚀 Features:
|
### 🚀 Features:
|
||||||
|
|
||||||
- Added long term statistics for some sensors #68. Thanks to @bogdanbujdea!
|
- Added long term statistics for some sensors #68. Thanks to @bogdanbujdea!
|
||||||
- Automatic redact sensitive data from debug log
|
- Automatic redact sensitive data from debug log
|
||||||
|
- Perpare for scheduler option (not yet ready)
|
||||||
|
|
||||||
## v1.7.6
|
## v1.7.6
|
||||||
### 🚀 Features:
|
### 🚀 Features:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
name: "Volvo2Mqtt"
|
name: "Volvo2Mqtt"
|
||||||
description: "Volvo AAOS MQTT bridge"
|
description: "Volvo AAOS MQTT bridge"
|
||||||
version: "1.7.7"
|
version: "1.7.9"
|
||||||
slug: "volvo2mqtt"
|
slug: "volvo2mqtt"
|
||||||
init: false
|
init: false
|
||||||
url: "https://github.com/Dielee/volvo2mqtt"
|
url: "https://github.com/Dielee/volvo2mqtt"
|
||||||
|
|||||||
+9
-3
@@ -1,6 +1,6 @@
|
|||||||
from config import settings
|
from config import settings
|
||||||
|
|
||||||
VERSION = "v1.7.7"
|
VERSION = "v1.7.9"
|
||||||
|
|
||||||
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"
|
||||||
@@ -20,6 +20,7 @@ BATTERY_CHARGE_STATE_URL = "https://api.volvocars.com/connected-vehicle/v2/vehic
|
|||||||
FUEL_STATE_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/fuel"
|
FUEL_STATE_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/fuel"
|
||||||
STATISTICS_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/statistics"
|
STATISTICS_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/statistics"
|
||||||
ENGINE_DIAGNOSTICS_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/engine"
|
ENGINE_DIAGNOSTICS_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/engine"
|
||||||
|
VEHICLE_DIAGNOSTICS_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles/{0}/diagnostics"
|
||||||
|
|
||||||
units = {
|
units = {
|
||||||
"en_GB": {
|
"en_GB": {
|
||||||
@@ -80,7 +81,7 @@ supported_entities = [
|
|||||||
{"name": "Estimated Charging Time", "domain": "sensor", "id": "estimated_charging_time", "unit": "minutes", "icon": "timer-sync-outline", "url": RECHARGE_STATE_URL, "state_class": "measurement"},
|
{"name": "Estimated Charging Time", "domain": "sensor", "id": "estimated_charging_time", "unit": "minutes", "icon": "timer-sync-outline", "url": RECHARGE_STATE_URL, "state_class": "measurement"},
|
||||||
{"name": "Charging System Status", "domain": "sensor", "id": "charging_system_status", "icon": "ev-station", "url": RECHARGE_STATE_URL},
|
{"name": "Charging System Status", "domain": "sensor", "id": "charging_system_status", "icon": "ev-station", "url": RECHARGE_STATE_URL},
|
||||||
{"name": "Charging Connection Status", "domain": "sensor", "id": "charging_connection_status", "icon": "ev-plug-ccs2", "url": RECHARGE_STATE_URL},
|
{"name": "Charging Connection Status", "domain": "sensor", "id": "charging_connection_status", "icon": "ev-plug-ccs2", "url": RECHARGE_STATE_URL},
|
||||||
{"name": "Estimated Charging Finish Time", "domain": "sensor", "id": "estimated_charging_finish_time", "icon": "timer-sync-outline", "url": RECHARGE_STATE_URL, "state_class": "measurement"},
|
{"name": "Estimated Charging Finish Time", "domain": "sensor", "id": "estimated_charging_finish_time", "icon": "timer-sync-outline", "url": RECHARGE_STATE_URL},
|
||||||
{"name": "Odometer", "domain": "sensor", "id": "odometer", "unit": "km" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["odometer"]["unit"], "icon": "counter", "url": ODOMETER_STATE_URL, "state_class":"total_increasing"},
|
{"name": "Odometer", "domain": "sensor", "id": "odometer", "unit": "km" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["odometer"]["unit"], "icon": "counter", "url": ODOMETER_STATE_URL, "state_class":"total_increasing"},
|
||||||
{"name": "Last Data Update", "domain": "sensor", "id": "last_data_update", "icon": "timer", "url": ""},
|
{"name": "Last Data Update", "domain": "sensor", "id": "last_data_update", "icon": "timer", "url": ""},
|
||||||
{"name": "Active schedules", "domain": "sensor", "id": "active_schedules", "icon": "timer", "url": ""},
|
{"name": "Active schedules", "domain": "sensor", "id": "active_schedules", "icon": "timer", "url": ""},
|
||||||
@@ -109,5 +110,10 @@ supported_entities = [
|
|||||||
{"name": "Fuel Level", "domain": "sensor", "id": "fuel_level", "unit": "liters", "icon": "fuel", "url": FUEL_STATE_URL, "state_class": "measurement"},
|
{"name": "Fuel Level", "domain": "sensor", "id": "fuel_level", "unit": "liters", "icon": "fuel", "url": FUEL_STATE_URL, "state_class": "measurement"},
|
||||||
{"name": "Average Fuel Consumption", "domain": "sensor", "id": "average_fuel_consumption", "unit": "liters", "icon": "fuel", "url": STATISTICS_URL},
|
{"name": "Average Fuel Consumption", "domain": "sensor", "id": "average_fuel_consumption", "unit": "liters", "icon": "fuel", "url": STATISTICS_URL},
|
||||||
{"name": "Distance to Empty", "domain": "sensor", "id": "distance_to_empty", "unit": "km" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["distance_to_empty"]["unit"], "icon": "map-marker-distance", "url": STATISTICS_URL, "state_class": "measurement"},
|
{"name": "Distance to Empty", "domain": "sensor", "id": "distance_to_empty", "unit": "km" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["distance_to_empty"]["unit"], "icon": "map-marker-distance", "url": STATISTICS_URL, "state_class": "measurement"},
|
||||||
{"name": "Average Speed", "domain": "sensor", "id": "average_speed", "unit": "km/h" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["average_speed"]["unit"], "icon": "speedometer", "url": STATISTICS_URL, "state_class": "measurement"}
|
{"name": "Average Speed", "domain": "sensor", "id": "average_speed", "unit": "km/h" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["average_speed"]["unit"], "icon": "speedometer", "url": STATISTICS_URL, "state_class": "measurement"},
|
||||||
|
{"name": "Hours to Service", "domain": "sensor", "id": "hours_to_service", "unit": "hour", "icon": "wrench-clock", "url": VEHICLE_DIAGNOSTICS_URL},
|
||||||
|
{"name": "Distance to Service", "domain": "sensor", "id": "km_to_service", "unit": "km" if not units.get(settings["babelLocale"]) else units[settings["babelLocale"]]["distance_to_service"]["unit"], "icon": "wrench-clock", "url": VEHICLE_DIAGNOSTICS_URL},
|
||||||
|
{"name": "Months to Service", "domain": "sensor", "id": "months_to_service", "unit": "month", "icon": "wrench-clock", "url": VEHICLE_DIAGNOSTICS_URL},
|
||||||
|
{"name": "Service warning status", "domain": "sensor", "id": "service_warning_status", "icon": "alert-outline", "url": VEHICLE_DIAGNOSTICS_URL},
|
||||||
|
{"name": "Service warning trigger", "domain": "sensor", "id": "service_warning_trigger", "icon": "alert-outline", "url": VEHICLE_DIAGNOSTICS_URL}
|
||||||
]
|
]
|
||||||
|
|||||||
+16
-1
@@ -228,7 +228,8 @@ def api_call(url, method, vin, sensor_id=None, force_update=False):
|
|||||||
if datetime.now(util.TZ) >= token_expires_at:
|
if datetime.now(util.TZ) >= token_expires_at:
|
||||||
refresh_auth()
|
refresh_auth()
|
||||||
|
|
||||||
if url in [RECHARGE_STATE_URL, WINDOWS_STATE_URL, LOCK_STATE_URL, TYRE_STATE_URL, STATISTICS_URL]:
|
if url in [RECHARGE_STATE_URL, WINDOWS_STATE_URL, LOCK_STATE_URL, TYRE_STATE_URL,
|
||||||
|
STATISTICS_URL, ENGINE_DIAGNOSTICS_URL]:
|
||||||
# Minimize API calls for endpoints with multiple values
|
# Minimize API calls for endpoints with multiple values
|
||||||
response = cached_request(url, method, vin, force_update)
|
response = cached_request(url, method, vin, force_update)
|
||||||
if response is None:
|
if response is None:
|
||||||
@@ -436,5 +437,19 @@ def parse_api_data(data, sensor_id=None):
|
|||||||
if distance_to_empty > 0:
|
if distance_to_empty > 0:
|
||||||
return util.convert_metric_values(data["distanceToEmpty"]["value"])
|
return util.convert_metric_values(data["distanceToEmpty"]["value"])
|
||||||
return None
|
return None
|
||||||
|
elif sensor_id == "hours_to_service":
|
||||||
|
return data["engineHoursToService"]["value"] if util.keys_exists(data, "engineHoursToService") else None
|
||||||
|
elif sensor_id == "km_to_service":
|
||||||
|
if util.keys_exists(data, "kmToService"):
|
||||||
|
km_to_service = int(data["kmToService"]["value"])
|
||||||
|
if km_to_service > 0:
|
||||||
|
return util.convert_metric_values(data["kmToService"]["value"])
|
||||||
|
return None
|
||||||
|
elif sensor_id == "months_to_service":
|
||||||
|
return data["monthsToService"]["value"] if util.keys_exists(data, "monthsToService") else None
|
||||||
|
elif sensor_id == "service_warning_status":
|
||||||
|
return data["serviceWarningStatus"]["value"] if util.keys_exists(data, "serviceWarningStatus") else None
|
||||||
|
elif sensor_id == "service_warning_trigger":
|
||||||
|
return data["serviceWarningTrigger"]["value"] if util.keys_exists(data, "serviceWarningTrigger") else None
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user