Skip to content

Commit abd57b3

Browse files
committed
replace gmqtt with aiomqtt
1 parent 401cd93 commit abd57b3

File tree

8 files changed

+184
-114
lines changed

8 files changed

+184
-114
lines changed

poetry.lock

Lines changed: 31 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ requires-python = '>=3.12,<4.0'
1818
dependencies = [
1919
"saic-ismart-client-ng (>=0.9.2,<0.10.0)",
2020
'httpx (>=0.28.1,<0.29.0)',
21-
'gmqtt (>=0.7.0,<0.8.0)',
2221
'inflection (>=0.5.1,<0.6.0)',
2322
'apscheduler (>=3.11.0,<4.0.0)',
2423
'python-dotenv (>=1.1.1,<2.0.0)',
24+
"aiomqtt (>=2.4.0,<3.0.0)",
2525
]
2626

2727
[project.urls]

src/configuration/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
from __future__ import annotations
22

33
from enum import Enum
4-
from typing import TYPE_CHECKING
4+
from typing import TYPE_CHECKING, Literal
55

66
if TYPE_CHECKING:
77
from integrations.openwb.charging_station import ChargingStation
88

99

10+
Transport = Literal["tcp", "websockets"]
11+
12+
1013
class TransportProtocol(Enum):
11-
def __init__(self, transport_mechanism: str, with_tls: bool) -> None:
14+
def __init__(self, transport_mechanism: Transport, with_tls: bool) -> None:
1215
self.transport_mechanism = transport_mechanism
1316
self.with_tls = with_tls
1417

src/configuration/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __parse_mqtt_transport(args: Namespace, config: Configuration) -> None:
102102
args.tls_server_cert_check_hostname
103103
)
104104
else:
105-
msg = f"Invalid MQTT URI scheme: {parse_result.scheme}, use tcp or ws"
105+
msg = f"Invalid MQTT URI scheme: {parse_result.scheme}, use tls, tcp or ws"
106106
raise SystemExit(msg)
107107

108108
if parse_result.port:

src/log_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
MODULES_DEFAULT_LOG_LEVEL = {
99
"asyncio": "WARNING",
10-
"gmqtt": "WARNING",
10+
"aiomqtt": "WARNING",
1111
"httpcore": "WARNING",
1212
"httpx": "WARNING",
1313
"saic_ismart_client_ng": "WARNING",

src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
configuration = process_command_line()
2222

2323
mqtt_gateway = MqttGateway(configuration)
24+
2425
asyncio.run(mqtt_gateway.run(), debug=debug_log_enabled())

0 commit comments

Comments
 (0)