Skip to content

Commit

Permalink
Merge pull request #1201 from samson0v/master
Browse files Browse the repository at this point in the history
Fixed MQTT RPC
  • Loading branch information
imbeacon authored Oct 26, 2023
2 parents 62a3ee0 + 432427e commit 1fed219
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion thingsboard_gateway/connectors/mqtt/mqtt_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def server_side_rpc_handler(self, content):
self.__log.info("Incoming server-side RPC: %s", content)

if content.get('data') is None:
content['data'] = {'params': content['params'], 'method': content['method']}
content['data'] = {'params': content['params'], 'method': content['method'], 'id': content['id']}

rpc_method = content['data']['method']

Expand Down
2 changes: 2 additions & 0 deletions thingsboard_gateway/gateway/tb_gateway_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ def _rpc_request_handler(self, request_id, content):
if device is not None:
connector_name = self.get_devices()[device].get("connector")
if connector_name is not None:
content['id'] = request_id
connector_name.server_side_rpc_handler(content)
else:
log.error("Received RPC request but connector for the device %s not found. Request data: \n %s",
Expand All @@ -1152,6 +1153,7 @@ def _rpc_request_handler(self, request_id, content):
if self.available_connectors[connector_name]._connector_type == module:
log.debug("Sending command RPC %s to connector %s", content["method"],
connector_name)
content['id'] = request_id
result = self.available_connectors[connector_name].server_side_rpc_handler(content)
elif module == 'gateway' or module in self.__remote_shell.shell_commands:
result = self.__rpc_gateway_processing(request_id, content)
Expand Down

0 comments on commit 1fed219

Please sign in to comment.