diff options
author | Karel Kočí <cynerd@email.cz> | 2023-01-10 19:03:37 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2023-01-10 19:03:37 +0100 |
commit | f84a97b9bf2665dea91f71fb1b0f938eeb725ccf (patch) | |
tree | 4e428d9f8a20457c8e9728085d611eee4f615282 | |
parent | 1a2c69a2152c315a964c0eb9b2673c70e52051b4 (diff) | |
download | bigclown-leds-f84a97b9bf2665dea91f71fb1b0f938eeb725ccf.tar.gz bigclown-leds-f84a97b9bf2665dea91f71fb1b0f938eeb725ccf.tar.bz2 bigclown-leds-f84a97b9bf2665dea91f71fb1b0f938eeb725ccf.zip |
-rwxr-xr-x | bigclown-leds | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bigclown-leds b/bigclown-leds index d988bdf..fdba7e4 100755 --- a/bigclown-leds +++ b/bigclown-leds @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import configparser import sys +import time import paho.mqtt.client as mqtt @@ -41,7 +42,12 @@ def main(): # client.on_log = on_log client.username_pw_set(cnf_mqtt["username"], cnf_mqtt["password"]) - client.connect("127.0.0.1", 1883, 60) + while True: + try: + client.connect("127.0.0.1", 1883, 60) + break + except ConnectionRefusedError: + time.sleep(1) client.loop_forever() |