diff --git a/backend/mqtt_integration.py b/backend/mqtt_integration.py index 3127203..ffba378 100644 --- a/backend/mqtt_integration.py +++ b/backend/mqtt_integration.py @@ -98,11 +98,13 @@ class HomeAssistantMQTT: self._reconnect_task = asyncio.create_task(self._reconnect_loop()) async def _post_connect(self): - """Tasks to perform after connection is established""" + """Post connection setup - subscribe to topics""" + logger.info("Connected to MQTT broker") + self._connected = True try: # Subscribe to command topic - await self.client.subscribe([(self.command_topic, 1)]) - logger.info(f"Subscribed to command topic: {self.command_topic}") + await self.client.subscribe([{'topic': self.command_topic, 'qos': 1}]) + logger.info(f"Subscribed to {self.command_topic}") # Publish discovery config config = {