From 5e7f7dbda6f1c5dc098bd90c929dd11f88ca82a0 Mon Sep 17 00:00:00 2001 From: Jesper Nilsson Date: Mon, 19 Oct 2020 07:55:22 +0000 Subject: [PATCH] fix error when mqtt is not configured --- src/lib/helpers.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/helpers.py b/src/lib/helpers.py index 5d4e3a285..aa488ac60 100644 --- a/src/lib/helpers.py +++ b/src/lib/helpers.py @@ -249,12 +249,12 @@ def report_labels( for label in labels_removed: mqtt_devices[label].publish(False) - for label, count in counter.items(): - if reported_label_count.get(label, 0) != count: - attributes = {} - attributes["count"] = count - mqtt_devices[label].publish(True, attributes) - reported_label_count[label] = count + for label, count in counter.items(): + if reported_label_count.get(label, 0) != count: + attributes = {} + attributes["count"] = count + mqtt_devices[label].publish(True, attributes) + reported_label_count[label] = count return labels, reported_label_count