diff --git a/web2mqtt/views.py b/web2mqtt/views.py index d7942bd..997e469 100644 --- a/web2mqtt/views.py +++ b/web2mqtt/views.py @@ -39,6 +39,9 @@ def command(): if request.args.get('opts'): opts = request.args.get('opts') + if not client.is_connected(): + print("reconnection to mqtt server...") + client.connect("192.168.178.76",1884,keepalive=60) client.publish(command,opts) content = f"Command: {command} triggered with opts: {opts}"