forked from peter/volvo2mqtt
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf6568d945 | ||
|
|
f8b6f9cf53 | ||
|
|
7c32ca59be | ||
|
|
67948b0900 | ||
|
|
48663d2e0d | ||
|
|
76cfa21db7 | ||
|
|
9d11dff24b | ||
|
|
3a4160451c | ||
|
|
515e1a8d27 | ||
|
|
4961f7bfad | ||
|
|
a68216bdd5 | ||
|
|
98d8dd7e65 |
@@ -171,6 +171,6 @@ Here is what every option means:
|
||||
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg
|
||||
[releases]: https://github.com/Dielee/volvo2mqtt/releases
|
||||
[releases-shield]: https://img.shields.io/github/release/Dielee/volvo2mqtt.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg
|
||||
[commits-shield]: https://img.shields.io/github/commit-activity/y/Dielee/volvo2mqtt.svg
|
||||
[commits]: https://github.com/Dielee/volvo2mqtt/commits/main
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
requests~=2.32.0
|
||||
dynaconf~=3.1.12
|
||||
paho-mqtt~=1.6.1
|
||||
Babel~=2.12.1
|
||||
pytz~=2023.3
|
||||
dynaconf~=3.2.13
|
||||
paho-mqtt~=2.1.0
|
||||
Babel~=2.18.0
|
||||
pytz~=2026.1.post1
|
||||
google_play_scraper~=1.2.6
|
||||
@@ -1,3 +1,34 @@
|
||||
## v1.13.5
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
- Add build.yaml for homeassistant version > 2026.04.X
|
||||
|
||||
## v1.13.4
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
- Fix `AttributeError: module 'paho.mqtt.client' has no attribute 'CallbackAPIVersion'` when paho-mqtt < 2.0 is installed
|
||||
|
||||
## v1.13.3
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
- Bump pypi packages
|
||||
|
||||
## v1.13.2
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
- Fix KeyError: 'authorizeResponse' in auth flow #318
|
||||
|
||||
## v1.13.1
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
- Fix missing charging system state `error` #314
|
||||
- Move `object_id` to `default_entity_id` for mqtt entities according to #312
|
||||
|
||||
## v1.13.0
|
||||
|
||||
### 🚀 Features:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
build_from:
|
||||
amd64: ghcr.io/home-assistant/base-python:latest
|
||||
aarch64: ghcr.io/home-assistant/base-python:latest
|
||||
armv7: ghcr.io/home-assistant/base-python:latest
|
||||
armhf: ghcr.io/home-assistant/base-python:latest
|
||||
i386: ghcr.io/home-assistant/base-python:latest
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
name: "Volvo2Mqtt"
|
||||
description: "Volvo AAOS MQTT bridge"
|
||||
version: "1.13.0"
|
||||
version: "1.13.5"
|
||||
slug: "volvo2mqtt"
|
||||
init: false
|
||||
url: "https://github.com/Dielee/volvo2mqtt"
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
from config import settings
|
||||
|
||||
VERSION = "v1.13.0"
|
||||
VERSION = "v1.13.5"
|
||||
|
||||
OAUTH_TOKEN_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2"
|
||||
OAUTH_AUTH_URL = "https://volvoid.eu.volvocars.com/as/authorization.oauth2"
|
||||
@@ -61,7 +61,8 @@ availability_topic = "volvoAAOS2mqtt/availability"
|
||||
|
||||
charging_system_states = {"CHARGING": "Charging", "IDLE": "Idle",
|
||||
"FAULT": "Fault", "UNSPECIFIED": "Unspecified",
|
||||
"DONE": "Done", "SCHEDULED": "Scheduled"}
|
||||
"DONE": "Done", "SCHEDULED": "Scheduled", "ERROR": "Error",
|
||||
"DISCHARGING": "Discharging"}
|
||||
|
||||
charging_connection_states = {"DISCONNECTED": "Disconnected", "UNSPECIFIED": "Unspecified",
|
||||
"FAULT": "Fault", "CONNECTED": "Connected"}
|
||||
|
||||
+17
-8
@@ -25,8 +25,13 @@ active_schedules = {}
|
||||
otp_code = None
|
||||
|
||||
def connect():
|
||||
client = mqtt.Client("volvoAAOS2mqtt") if os.environ.get("IS_HA_ADDON") \
|
||||
else mqtt.Client("volvoAAOS2mqtt_" + settings.volvoData["username"].replace("+", ""))
|
||||
client_id = "volvoAAOS2mqtt" if os.environ.get("IS_HA_ADDON") \
|
||||
else "volvoAAOS2mqtt_" + settings.volvoData["username"].replace("+", "")
|
||||
try:
|
||||
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, client_id, clean_session=False)
|
||||
except AttributeError:
|
||||
# paho-mqtt < 2.0 does not have CallbackAPIVersion
|
||||
client = mqtt.Client(client_id)
|
||||
|
||||
if "logging" in settings["mqtt"] and settings["mqtt"]["logging"]:
|
||||
mqtt_logger = logging.getLogger("mqtt")
|
||||
@@ -35,6 +40,7 @@ def connect():
|
||||
client.on_message = safe_on_message
|
||||
client.on_disconnect = on_disconnect
|
||||
client.on_connect = on_connect
|
||||
client.reconnect_delay_set(min_delay=1, max_delay=30)
|
||||
|
||||
client.will_set(availability_topic, "offline", 0, False)
|
||||
if settings["mqtt"]["username"] and settings["mqtt"]["password"]:
|
||||
@@ -45,10 +51,9 @@ def connect():
|
||||
if isinstance(conf_port, int):
|
||||
if conf_port > 0:
|
||||
port = settings["mqtt"]["port"]
|
||||
client.connect(settings["mqtt"]["broker"], port)
|
||||
client.connect(settings["mqtt"]["broker"], port, 120)
|
||||
|
||||
client.loop_start()
|
||||
client.subscribe("volvoAAOS2mqtt/otp_code")
|
||||
|
||||
global mqtt_client
|
||||
mqtt_client = client
|
||||
@@ -58,7 +63,7 @@ def create_otp_input():
|
||||
state_topic = otp_mqtt_topic + "/state"
|
||||
config = {
|
||||
"name": "Volvo OTP",
|
||||
"object_id": "volvo_otp",
|
||||
"default_entity_id": "volvo_otp",
|
||||
"schema": "state",
|
||||
"command_topic": otp_mqtt_topic,
|
||||
"state_topic": state_topic,
|
||||
@@ -95,7 +100,7 @@ def send_car_images(vin, data, device):
|
||||
image_topic = f"homeassistant/image/{vin}_{entity['id']}/image_topic"
|
||||
config = {
|
||||
"name": entity["name"],
|
||||
"object_id": f"volvo_{vin}_{entity['id']}",
|
||||
"default_entity_id": f"volvo_{vin}_{entity['id']}",
|
||||
"schema": "state",
|
||||
"icon": "mdi:image-area",
|
||||
"content_type": "image/png",
|
||||
@@ -140,6 +145,7 @@ def on_connect(client, userdata, flags, rc):
|
||||
logging.info("MQTT connected")
|
||||
|
||||
send_heartbeat()
|
||||
mqtt_client.subscribe("volvoAAOS2mqtt/otp_code")
|
||||
if len(subscribed_topics) > 0:
|
||||
for topic in subscribed_topics:
|
||||
mqtt_client.subscribe(topic)
|
||||
@@ -405,7 +411,7 @@ def update_ha_device(entity, vin, state):
|
||||
logging.debug("Updating icon to " + icon + " for " + entity["id"])
|
||||
config = {
|
||||
"name": entity['name'],
|
||||
"object_id": f"volvo_{vin}_{entity['id']}",
|
||||
"default_entity_id": f"volvo_{vin}_{entity['id']}",
|
||||
"schema": "state",
|
||||
"icon": f"mdi:{icon}" if icon else f"mdi:{entity['icon']}",
|
||||
"state_topic": f"homeassistant/{entity['domain']}/{vin}_{entity['id']}/state",
|
||||
@@ -434,6 +440,7 @@ def update_ha_device(entity, vin, state):
|
||||
mqtt_client.publish(
|
||||
f"homeassistant/{entity['domain']}/volvoAAOS2mqtt/{vin}_{entity['id']}/config",
|
||||
json.dumps(config),
|
||||
qos=1,
|
||||
retain=True
|
||||
)
|
||||
|
||||
@@ -446,7 +453,7 @@ def create_ha_devices():
|
||||
for entity in volvo.supported_endpoints[vin]:
|
||||
config = {
|
||||
"name": entity['name'],
|
||||
"object_id": f"volvo_{vin}_{entity['id']}",
|
||||
"default_entity_id": f"volvo_{vin}_{entity['id']}",
|
||||
"schema": "state",
|
||||
"icon": f"mdi:{entity['icon']}",
|
||||
"state_topic": f"homeassistant/{entity['domain']}/{vin}_{entity['id']}/state",
|
||||
@@ -484,8 +491,10 @@ def create_ha_devices():
|
||||
mqtt_client.publish(
|
||||
f"homeassistant/{entity['domain']}/volvoAAOS2mqtt/{vin}_{entity['id']}/config",
|
||||
json.dumps(config),
|
||||
qos=1,
|
||||
retain=True
|
||||
)
|
||||
time.sleep(0.05)
|
||||
time.sleep(2)
|
||||
send_heartbeat()
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ def authorize(renew_tokenfile=False):
|
||||
|
||||
def continue_auth(auth_session, data):
|
||||
next_url = data["_links"]["continueAuthentication"]["href"].replace("http://", "https://") + "?action=continueAuthentication"
|
||||
auth = auth_session.get(next_url)
|
||||
auth = auth_session.post(next_url, data="{}")
|
||||
|
||||
if auth.status_code == 200:
|
||||
return auth.json()
|
||||
|
||||
Reference in New Issue
Block a user