From 3f2dc8dceb892bbe85394bb990aa8da4aa41e911 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sat, 19 Nov 2022 10:18:37 -0700 Subject: [PATCH] Don't set connected until rc code is checked --- frigate/mqtt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/mqtt.py b/frigate/mqtt.py index 78efe83a3..53a073d5e 100644 --- a/frigate/mqtt.py +++ b/frigate/mqtt.py @@ -285,7 +285,6 @@ class FrigateMqttClient: def _on_connect(self, client: mqtt.Client, userdata, flags, rc) -> None: """Mqtt connection callback.""" - self.connected = True threading.current_thread().name = "mqtt" if rc != 0: if rc == 3: @@ -304,6 +303,7 @@ class FrigateMqttClient: + str(rc) ) + self.connected = True logger.debug("MQTT connected") client.subscribe(f"{self.mqtt_config.topic_prefix}/#") self._set_initial_topics()