mqtt: don't publish status updates when disconnected

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-11-03 08:13:52 -04:00
parent eec60a760b
commit 6a39bbd0c3
1 changed files with 1 additions and 1 deletions

View File

@ -611,7 +611,7 @@ class MQTTClient(APITransport, Subscribable):
status: Dict[str, Any],
eventtime: float
) -> None:
if not status:
if not status or not self.is_connected():
return
payload = {'eventtime': eventtime, 'status': status}
self.publish_topic(self.klipper_status_topic, payload)