Fixing OWRX startup breaking down if MQTT connection fails.
This commit is contained in:
parent
54fc19b01b
commit
c8748d7482
|
|
@ -40,7 +40,11 @@ class MqttReporter(Reporter):
|
|||
host = parts[0]
|
||||
if len(parts) > 1:
|
||||
port = int(parts[1])
|
||||
client.connect(host=host, port=port)
|
||||
|
||||
try:
|
||||
client.connect(host=host, port=port)
|
||||
except Exception as e:
|
||||
logger.debug("Exception connecting: " + str(e))
|
||||
|
||||
threading.Thread(target=client.loop_forever).start()
|
||||
|
||||
|
|
@ -53,6 +57,7 @@ class MqttReporter(Reporter):
|
|||
self.topic = topic
|
||||
|
||||
def _reconnect(self, *args, **kwargs):
|
||||
logger.debug("Reconnecting...")
|
||||
old = self.client
|
||||
self.client = self._getClient()
|
||||
old.disconnect()
|
||||
|
|
|
|||
Loading…
Reference in New Issue