From 6c4410095fe4ae326f9334e34d6ff51e874830e5 Mon Sep 17 00:00:00 2001 From: ferdzo Date: Thu, 29 Aug 2024 23:56:11 +0200 Subject: [PATCH] Finally fixed. --- iotDashboard/mqtt_service.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iotDashboard/mqtt_service.py b/iotDashboard/mqtt_service.py index 3e30db7..3d2ec5f 100644 --- a/iotDashboard/mqtt_service.py +++ b/iotDashboard/mqtt_service.py @@ -64,11 +64,11 @@ def start_mqtt_client(): # Keep the script running try: while True: - time.sleep(10) # Sleep to prevent high CPU usage + time.sleep(10) except KeyboardInterrupt: print("Script interrupted by user") finally: - client.loop_stop() # Stop the loop when exiting + client.loop_stop() if __name__ == "__main__":