From 5d35433dd0409a1b0681080a04d9eae6ac7c2d71 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 25 Oct 2024 08:28:54 -0600 Subject: [PATCH] Adjust mqtt logging behavior --- frigate/comms/mqtt.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frigate/comms/mqtt.py b/frigate/comms/mqtt.py index ca9d03da7..a3ba6a997 100644 --- a/frigate/comms/mqtt.py +++ b/frigate/comms/mqtt.py @@ -18,7 +18,6 @@ class MqttClient(Communicator): # type: ignore[misc] self.config = config self.mqtt_config = config.mqtt self.connected = False - self.started = False def subscribe(self, receiver: Callable) -> None: """Wrapper for allowing dispatcher to subscribe.""" @@ -28,8 +27,7 @@ class MqttClient(Communicator): # type: ignore[misc] def publish(self, topic: str, payload: Any, retain: bool = False) -> None: """Wrapper for publishing when client is in valid state.""" if not self.connected: - if self.started: - logger.error(f"Unable to publish to {topic}: client is not connected") + logger.debug(f"Unable to publish to {topic}: client is not connected") return self.client.publish( @@ -247,7 +245,6 @@ class MqttClient(Communicator): # type: ignore[misc] # with connect_async, retries are handled automatically self.client.connect_async(self.mqtt_config.host, self.mqtt_config.port, 60) self.client.loop_start() - self.started = True except Exception as e: logger.error(f"Unable to connect to MQTT server: {e}") return