api: ensure mqtt futures exists as attributes
All checks were successful
Build Container / Build Container (push) Successful in 4m41s

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.
This commit is contained in:
lilly 2026-10-18 19:01:35 +02:00
commit 57fa0aa4a0
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g

View file

@ -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,