From cca4dbaf14ce3e4d1ef7e035fc8dc291b3569ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Mon, 15 Aug 2022 06:28:33 +0200 Subject: [PATCH] added failover mech MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 566e9b5..172ed53 100644 --- a/main.py +++ b/main.py @@ -169,7 +169,11 @@ if __name__ == '__main__': client = mqtt.Client("server_rack_led") client.username_pw_set("mqtt", "pmMQTT_11!") debug_print("Connecting to MQTT Broker "+str(mqttBroker)) - client.connect(mqttBroker) + try: + client.connect(mqttBroker) + except: + time.sleep(20) + client.connect(mqttBroker) client.on_connect = mqtt_on_connect client.on_message = mqtt_on_message