Add 20s delay on initial connect, and 60s for exception retries
This commit is contained in:
3
hc2mqtt
3
hc2mqtt
@@ -168,6 +168,7 @@ def client_connect(client, device, mqtt_topic):
|
|||||||
client.subscribe(mqtt_set_topic)
|
client.subscribe(mqtt_set_topic)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
time.sleep(20)
|
||||||
try:
|
try:
|
||||||
print(now(), device["name"], f"connecting to {host}")
|
print(now(), device["name"], f"connecting to {host}")
|
||||||
ws = HCSocket(host, device["key"], device.get("iv", None))
|
ws = HCSocket(host, device["key"], device.get("iv", None))
|
||||||
@@ -210,7 +211,7 @@ def client_connect(client, device, mqtt_topic):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(device["name"], "ERROR", e, file=sys.stderr)
|
print(device["name"], "ERROR", e, file=sys.stderr)
|
||||||
|
|
||||||
time.sleep(60)
|
time.sleep(40)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user