diff --git a/setup.py b/setup.py index 46198cbc..31214ceb 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,6 @@ setup( 'grpcio<=1.43.0', 'protobuf', 'cachetools', - 'tb-mqtt-client' ], download_url='https://github.com/thingsboard/thingsboard-gateway/archive/%s.tar.gz' % VERSION, entry_points={ diff --git a/tb_mqtt_client b/tb_mqtt_client index 1dd202aa..9a2454a4 160000 --- a/tb_mqtt_client +++ b/tb_mqtt_client @@ -1 +1 @@ -Subproject commit 1dd202aa5510b98cdab74cfc4b68882ff651e815 +Subproject commit 9a2454a45287327cdf7a4faa8006496c9c042837 diff --git a/thingsboard_gateway/gateway/tb_client.py b/thingsboard_gateway/gateway/tb_client.py index 209d417f..995a9e8d 100644 --- a/thingsboard_gateway/gateway/tb_client.py +++ b/thingsboard_gateway/gateway/tb_client.py @@ -16,9 +16,15 @@ import logging import threading from time import sleep, time from ssl import CERT_REQUIRED, PROTOCOL_TLSv1_2 -from tb_mqtt_client.tb_gateway_mqtt import TBGatewayMqttClient from thingsboard_gateway.tb_utility.tb_utility import TBUtility +try: + from tb_gateway_mqtt import TBGatewayMqttClient +except ImportError: + print("tb-mqtt-client library not found - installing...") + TBUtility.install_package('tb-mqtt-client') + from tb_gateway_mqtt import TBGatewayMqttClient + log = logging.getLogger("tb_connection") CHECK_CERT_PERIOD = 86400