1
0
mirror of https://github.com/thingsboard/thingsboard-gateway synced 2025-10-26 22:31:42 +08:00

Some improvements

This commit is contained in:
zbeacon
2020-06-29 10:33:12 +03:00
parent 7ea7c65e42
commit b2123a5876
2 changed files with 3 additions and 1 deletions

View File

@@ -69,7 +69,7 @@ class ModbusConnector(Connector, threading.Thread):
def run(self):
while not self.__master.connect():
time.sleep(5)
log.warning("Modbus trying reconnect to %s", self.__config.get("name"))
log.warning("Modbus trying reconnect to %s", self.__config.get("host"))
log.info("Modbus connected.")
self.__connected = True

View File

@@ -188,11 +188,13 @@ class TBDeviceMqttClient:
5: "not authorised",
}
if self.__connect_callback:
time.sleep(.05)
self.__connect_callback(client, userdata, flags, result_code, *extra_params)
if result_code == 0:
self.__is_connected = True
log.info("connection SUCCESS")
log.debug(client)
time.sleep(.05)
self._client.subscribe(ATTRIBUTES_TOPIC, qos=1)
self._client.subscribe(ATTRIBUTES_TOPIC + "/response/+", 1)
self._client.subscribe(RPC_REQUEST_TOPIC + '+')