From 795b527f90ec08f28faa3379ee3a0524241275e3 Mon Sep 17 00:00:00 2001 From: Marcus Brown Date: Sun, 20 Oct 2024 18:38:03 +1100 Subject: [PATCH] Fix indentation errors in on_connect function to resolve runtime issues - Corrected inconsistent indentation to match the expected Python format. - Ensured proper alignment of the `on_connect` function code block to avoid `IndentationError`. --- dayglo_detector/dayglo_detector.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dayglo_detector/dayglo_detector.py b/dayglo_detector/dayglo_detector.py index e1f6290..3d85171 100644 --- a/dayglo_detector/dayglo_detector.py +++ b/dayglo_detector/dayglo_detector.py @@ -32,13 +32,13 @@ initial_snapshot_processed = False def on_connect(client, userdata, flags, reasonCode, properties=None): try: if reasonCode == 0: - print("Connected successfully to MQTT broker") - client.subscribe(MQTT_SNAPSHOT_TOPIC, qos=1) - print(f"Subscribed to topic: {MQTT_SNAPSHOT_TOPIC}") - publish_discovery_configurations() - # Publish initial rating of 0 - publish_rating(0) - else: + print("Connected successfully to MQTT broker") + client.subscribe(MQTT_SNAPSHOT_TOPIC, qos=1) + print(f"Subscribed to topic: {MQTT_SNAPSHOT_TOPIC}") + publish_discovery_configurations() + # Publish initial rating of 0 + publish_rating(0) + else: print(f"Failed to connect, return code {reasonCode}") except Exception as e: print(f"Caught exception in on_connect: {e}")