Add 20s delay on initial connect, and 60s for exception retries

This commit is contained in:
Meatballs1
2024-03-20 14:10:03 +00:00
parent 846b1abca0
commit c89962de30

View File

@@ -168,6 +168,7 @@ def client_connect(client, device, mqtt_topic):
client.subscribe(mqtt_set_topic)
while True:
time.sleep(20)
try:
print(now(), device["name"], f"connecting to {host}")
ws = HCSocket(host, device["key"], device.get("iv", None))
@@ -210,7 +211,7 @@ def client_connect(client, device, mqtt_topic):
except Exception as e:
print(device["name"], "ERROR", e, file=sys.stderr)
time.sleep(60)
time.sleep(40)
if __name__ == "__main__":