add reconnect time set in function
This commit is contained in:
parent
87a76f2e6f
commit
bd5a321140
|
@ -93,6 +93,7 @@ class Controller:
|
||||||
self.mqtt.on_disconnect = self.on_disconnect
|
self.mqtt.on_disconnect = self.on_disconnect
|
||||||
self.mqtt.connect(self.mqtthost, self.mqttport)
|
self.mqtt.connect(self.mqtthost, self.mqttport)
|
||||||
self.topic = self.basetopic
|
self.topic = self.basetopic
|
||||||
|
self.last_reconnectTry=time.time()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -266,7 +267,6 @@ class Controller:
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
if (time.time()>self.last_reconnectTry+30):
|
if (time.time()>self.last_reconnectTry+30):
|
||||||
self.connectToMQTT()
|
self.connectToMQTT()
|
||||||
self.last_reconnectTry=time.time()
|
|
||||||
self.mqtt.loop(0.1) #with block timeout
|
self.mqtt.loop(0.1) #with block timeout
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue