From 57fa0aa4a0f855b98d5bd4a34bcfe60614eddc51 Mon Sep 17 00:00:00 2001 From: lilly Date: Sun, 18 Oct 2026 19:01:35 +0200 Subject: [PATCH] api: ensure mqtt futures exists as attributes We were running into a bug where, during a server initiated disconnect, the client would try to read an attribute on its instance that had never been written to. This resulted in an AttributeError exception being thrown that effectively killed the whole MQTT task and kept the app from ever doing any MQTT related things again. --- api/src/dooris_api/mqtt_client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/src/dooris_api/mqtt_client.py b/api/src/dooris_api/mqtt_client.py index a090c5f..505588a 100644 --- a/api/src/dooris_api/mqtt_client.py +++ b/api/src/dooris_api/mqtt_client.py @@ -78,6 +78,10 @@ class AsyncMqttClient: self.client.on_subscribe = self.on_subscribe self.client.on_unsubscribe = self.on_unsubscribe self.client.on_disconnect = self.on_disconnect + self.fut_disconnect = None + self.fut_connected = None + self.fut_subscribe = None + self.fut_unsubscribe = None def on_connect( self,