aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbigclown-leds8
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()