Finally fixed.

This commit is contained in:
ferdzo
2024-08-29 23:56:11 +02:00
parent 3f6229e1f7
commit 6c4410095f

View File

@@ -64,11 +64,11 @@ def start_mqtt_client():
# Keep the script running # Keep the script running
try: try:
while True: while True:
time.sleep(10) # Sleep to prevent high CPU usage time.sleep(10)
except KeyboardInterrupt: except KeyboardInterrupt:
print("Script interrupted by user") print("Script interrupted by user")
finally: finally:
client.loop_stop() # Stop the loop when exiting client.loop_stop()
if __name__ == "__main__": if __name__ == "__main__":