Verified Commit 2c77f8ac authored by Xesxen's avatar Xesxen
Browse files

MQTT: Add reconnect logic

parent 008a6dd8
......@@ -176,6 +176,14 @@ async def mqtt_handler():
c.on_message = on_message
def on_disconnect(client, userdata, rc):
if rc != 0:
print("Unexpectedly lost connection to MQTT, restarting handler")
loop.run_until_complete(mqtt_handler())
pass
c.on_disconnect = on_disconnect
if args.enable_mqtt:
loop.run_until_complete(mqtt_handler())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment