Compare commits

...
3 Commits
Author SHA1 Message Date
Dielee ad691b6153 Update CHANGELOG.md 2023-07-06 13:26:56 +02:00
Dielee b6e423839a Update CHANGELOG.md 2023-07-06 11:12:31 +02:00
Dielee 044e71d862 Fix undocumented charging connection state #57 2023-07-06 11:10:58 +02:00
5 changed files with 41 additions and 10 deletions
+10
View File
@@ -1,3 +1,13 @@
## v1.7.5
### 🚀 Features:
- Added support for `LOCKING` and `UNLOCKING` state (Lock entity)
## v1.7.4
### 🐛 Bug Fixes:
- Fixed undocumented charging connection state `CONNECTION_STATUS_FAULT` '#57
## v1.7.3 ## v1.7.3
### 🐛 Bug Fixes: ### 🐛 Bug Fixes:
+1 -1
View File
@@ -1,6 +1,6 @@
name: "Volvo2Mqtt" name: "Volvo2Mqtt"
description: "Volvo AAOS MQTT bridge" description: "Volvo AAOS MQTT bridge"
version: "1.7.3" version: "1.7.5"
slug: "volvo2mqtt" slug: "volvo2mqtt"
init: false init: false
url: "https://github.com/Dielee/volvo2mqtt" url: "https://github.com/Dielee/volvo2mqtt"
+4 -3
View File
@@ -1,6 +1,6 @@
from config import settings from config import settings
VERSION = "v1.7.3" VERSION = "v1.7.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"
@@ -44,14 +44,15 @@ charging_system_states = {"CHARGING_SYSTEM_CHARGING": "Charging", "CHARGING_SYST
"CHARGING_SYSTEM_FAULT": "Fault", "CHARGING_SYSTEM_UNSPECIFIED": "Unspecified"} "CHARGING_SYSTEM_FAULT": "Fault", "CHARGING_SYSTEM_UNSPECIFIED": "Unspecified"}
charging_connection_states = {"CONNECTION_STATUS_DISCONNECTED": "Disconnected", "CONNECTION_STATUS_UNSPECIFIED": "Unspecified", charging_connection_states = {"CONNECTION_STATUS_DISCONNECTED": "Disconnected", "CONNECTION_STATUS_UNSPECIFIED": "Unspecified",
"CONNECTION_STATUS_CONNECTED_DC": "Connected DC", "CONNECTION_STATUS_CONNECTED_AC": "Connected AC"} "CONNECTION_STATUS_CONNECTED_DC": "Connected DC", "CONNECTION_STATUS_CONNECTED_AC": "Connected AC",
"CONNECTION_STATUS_FAULT": "Fault"}
window_states = {"CLOSED": "OFF", "OPEN": "ON"} window_states = {"CLOSED": "OFF", "OPEN": "ON"}
door_states = {"CLOSED": "OFF", "OPEN": "ON"} door_states = {"CLOSED": "OFF", "OPEN": "ON"}
engine_states = {"RUNNING": "ON", "STOPPED": "OFF", "true": "ON", "false": "OFF"} engine_states = {"RUNNING": "ON", "STOPPED": "OFF", "true": "ON", "false": "OFF"}
icon_states = { icon_states = {
"lock_status": {"UNLOCKED": "lock-open-alert", "LOCKED": "lock"}, "lock_status": {"UNLOCKED": "lock-open-alert", "LOCKED": "lock", "UNLOCKING": "lock-reset", "LOCKING": "lock-reset"},
"door_front_left": {"ON": "car-door", "OFF": "car-door-lock"}, "door_front_left": {"ON": "car-door", "OFF": "car-door-lock"},
"door_front_right": {"ON": "car-door", "OFF": "car-door-lock"}, "door_front_right": {"ON": "car-door", "OFF": "car-door-lock"},
"door_rear_left": {"ON": "car-door", "OFF": "car-door-lock"}, "door_rear_left": {"ON": "car-door", "OFF": "car-door-lock"},
+12 -6
View File
@@ -96,15 +96,21 @@ def on_message(client, userdata, msg):
update_car_data() update_car_data()
elif "lock_status" in msg.topic: elif "lock_status" in msg.topic:
if payload == "LOCK": if payload == "LOCK":
volvo.api_call(CAR_LOCK_URL, "POST", vin) # Start the api call in another thread for HA performance
Thread(target=volvo.api_call, args=(CAR_LOCK_URL, "POST", vin)).start()
# Force set unlocked state in HA because of slow api response # Force set locking state
update_car_data(True, {"entity_id": "lock_status", "vin": vin, "state": "LOCKED"}) update_car_data(False, {"entity_id": "lock_status", "vin": vin, "state": "LOCKING"})
# Fetch API lock state until locking finished
Thread(target=volvo.check_lock_status, args=(vin, "UNLOCKED")).start()
elif payload == "UNLOCK": elif payload == "UNLOCK":
volvo.api_call(CAR_UNLOCK_URL, "POST", vin) # Start the api call in another thread for HA performance
Thread(target=volvo.api_call, args=(CAR_UNLOCK_URL, "POST", vin)).start()
# Force set unlocked state in HA because of slow api response # Force set unlocking state
update_car_data(True, {"entity_id": "lock_status", "vin": vin, "state": "UNLOCKED"}) update_car_data(False, {"entity_id": "lock_status", "vin": vin, "state": "UNLOCKING"})
# Fetch API lock state until unlocking finished
Thread(target=volvo.check_lock_status, args=(vin, "LOCKED")).start()
elif "update_data" in msg.topic: elif "update_data" in msg.topic:
if payload == "PRESS": if payload == "PRESS":
update_car_data(True) update_car_data(True)
+14
View File
@@ -179,6 +179,20 @@ def disable_climate(vin):
mqtt.update_car_data() mqtt.update_car_data()
def check_lock_status(vin, old_state):
max_runs = 10
done_runs = 0
lock_state = api_call(LOCK_STATE_URL, "GET", vin, "lock_status", True)
while lock_state == old_state:
done_runs = done_runs + 1
if done_runs >= max_runs:
break
lock_state = api_call(LOCK_STATE_URL, "GET", vin, "lock_status", True)
time.sleep(2)
mqtt.update_car_data()
def check_engine_status(vin): def check_engine_status(vin):
endpoint_url = "" endpoint_url = ""
engine_state_supported = False engine_state_supported = False