Fix logic

This commit is contained in:
Nicolas Mowen 2024-10-25 06:37:26 -06:00
parent 08e58bd60b
commit 6ccabdb747

View File

@ -27,8 +27,9 @@ class MqttClient(Communicator): # type: ignore[misc]
def publish(self, topic: str, payload: Any, retain: bool = False) -> None: def publish(self, topic: str, payload: Any, retain: bool = False) -> None:
"""Wrapper for publishing when client is in valid state.""" """Wrapper for publishing when client is in valid state."""
if not self.connected and self.started: if not self.connected:
logger.error(f"Unable to publish to {topic}: client is not connected") if self.started:
logger.error(f"Unable to publish to {topic}: client is not connected")
return return
self.client.publish( self.client.publish(