mirror of
https://github.com/thingsboard/thingsboard-gateway
synced 2025-10-26 22:31:42 +08:00
Some improvements
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 + '+')
|
||||
|
||||
Reference in New Issue
Block a user