From 92daf9c8ad6e6faf51caaf0fd31cbced2882418c Mon Sep 17 00:00:00 2001 From: Josh Finlay Date: Wed, 8 Jan 2025 10:04:00 +1000 Subject: [PATCH] fix: mqtt subscription format - Updated subscription format to use dict with topic and qos fields - Fixed both _post_connect and subscribe methods --- backend/mqtt_integration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/mqtt_integration.py b/backend/mqtt_integration.py index b295b44..3de5b3e 100644 --- a/backend/mqtt_integration.py +++ b/backend/mqtt_integration.py @@ -102,8 +102,8 @@ class HomeAssistantMQTT: logger.info("Connected to MQTT broker") self._connected = True try: - # Subscribe to command topic - await self.client.subscribe([(self.command_topic, 1)]) + # Subscribe to command topic using a dict + await self.client.subscribe([{'topic': self.command_topic, 'qos': 1}]) logger.info(f"Subscribed to command topic: {self.command_topic}") # Publish discovery config @@ -192,7 +192,7 @@ class HomeAssistantMQTT: """Subscribe to a topic""" if self.client and self._connected: try: - await self.client.subscribe([(topic, 0)]) + await self.client.subscribe([{'topic': topic, 'qos': 1}]) except Exception as e: logger.error(f"Failed to subscribe to topic: {e}")