Added reconnect
This commit is contained in:
@@ -39,6 +39,9 @@ def command():
|
|||||||
if request.args.get('opts'):
|
if request.args.get('opts'):
|
||||||
opts = 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)
|
client.publish(command,opts)
|
||||||
|
|
||||||
content = f"Command: {command} triggered with opts: {opts}"
|
content = f"Command: {command} triggered with opts: {opts}"
|
||||||
|
|||||||
Reference in New Issue
Block a user