diff --git a/thingsboard_gateway/gateway/tb_client.py b/thingsboard_gateway/gateway/tb_client.py index f17eb988..c9cfc58d 100644 --- a/thingsboard_gateway/gateway/tb_client.py +++ b/thingsboard_gateway/gateway/tb_client.py @@ -132,9 +132,15 @@ class TBClient(threading.Thread): if credentials.get("clientId") is not None: self.__client_id = str(credentials["clientId"]) - self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self, - quality_of_service=self.__default_quality_of_service, - client_id=self.__client_id) + if self.__config.get('rateLimits'): + self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self, + quality_of_service=self.__default_quality_of_service, + client_id=self.__client_id, rate_limit=self.__config['rateLimits']) + else: + self.client = TBGatewayMqttClient(self.__host, self.__port, self.__username, self.__password, self, + quality_of_service=self.__default_quality_of_service, + client_id=self.__client_id) + if self.__tls: self.__ca_cert = self.__config_folder_path + credentials.get("caCert") if credentials.get( "caCert") is not None else None diff --git a/thingsboard_gateway/gateway/tb_gateway_service.py b/thingsboard_gateway/gateway/tb_gateway_service.py index fefcf65e..9ffdad19 100644 --- a/thingsboard_gateway/gateway/tb_gateway_service.py +++ b/thingsboard_gateway/gateway/tb_gateway_service.py @@ -132,6 +132,8 @@ def get_env_variables(): env_variables['username'] = environ.get('TB_GW_USERNAME') if environ.get('TB_GW_PASSWORD'): env_variables['password'] = environ.get('TB_GW_PASSWORD') + if environ.get('TB_GW_RATE_LIMITS'): + env_variables['rateLimits'] = environ.get('TB_GW_RATE_LIMITS') converted_env_variables = {}