From 3da6cefe8d229e0187eabdcf4fe55848e212becc Mon Sep 17 00:00:00 2001 From: jaydee Date: Sun, 7 Jul 2024 20:10:54 +0200 Subject: [PATCH] bitwarden --- playbooks/files/scripts/mqtt_srv.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/playbooks/files/scripts/mqtt_srv.py b/playbooks/files/scripts/mqtt_srv.py index 3aa8eaf..6071cb3 100644 --- a/playbooks/files/scripts/mqtt_srv.py +++ b/playbooks/files/scripts/mqtt_srv.py @@ -934,7 +934,15 @@ client.will_set("home-assistant/" + host.lower() + "/hwstats", payload=payload, client.on_connect = on_connect client.on_message = on_message writeLog(MQTT_HOST) -client.connect(MQTT_HOST, MQTT_PORT, 25) +connected = False +while not connected: + try: + client.connect(MQTT_HOST, MQTT_PORT, 25) + connected = True + except: + writeLog("Failed to connect repeating...") + time.sleep(10) + # client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)