Sholofly / lghorizon

Custom integration to control LG Horizon settop boxes for Ziggo(NL), Magenta(AT), UPC(CH), Virgin(GB, IE), Telenet(BE)
GNU General Public License v3.0
63 stars 15 forks source link

MQTT connection error #123

Closed AndrewKlopper closed 2 months ago

AndrewKlopper commented 2 months ago

Running the test.py script results in the following error after authentication when trying to connect to a Ziggo NL account:

2024-08-26 17:06:56,098 - INFO - Backing off connect(...) for 2.0s (ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details)
Backing off connect(...) for 2.0s (ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details)

This can be fixed with the following modification to the models.py file:

--- models.py.orig      2024-08-26 17:05:58.675362315 +0200
+++ models.py   2024-08-26 17:06:04.335404067 +0200
@@ -335,7 +335,7 @@
         self._auth = auth
         self._brokerUrl = mqtt_broker_url.replace("wss://", "").replace(":443/mqtt", "")
         self.clientId = make_id()
-        self._mqtt_client = mqtt.Client(self.clientId, transport="websockets")
+        self._mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1, self.clientId, transport="websockets")

         self._mqtt_client.ws_set_options(
             headers={"Sec-WebSocket-Protocol": "mqtt, mqttv3.1, mqttv3.11"}
AndrewKlopper commented 2 months ago

Sorry. Added this issue to the wrong project.