Skip to content

Commit

Permalink
Rpc response format changed to string if it received like this from c…
Browse files Browse the repository at this point in the history
…onnector
  • Loading branch information
imbeacon committed Dec 3, 2024
1 parent 2fa149b commit 2c433a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions thingsboard_gateway/connectors/modbus/entities/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,35 @@ async def close(self):

@with_lock_for_serial
async def read_coils(self, address, count, unit_id):
return await self.__client.read_coils(address=address, count=count, slave=unit_id)
return await self.__client.read_coils(address=address, count=count, slave=unit_id) # noqa

@with_lock_for_serial
async def read_discrete_inputs(self, address, count, unit_id):
return await self.__client.read_discrete_inputs(address=address, count=count, slave=unit_id)
return await self.__client.read_discrete_inputs(address=address, count=count, slave=unit_id) # noqa

@with_lock_for_serial
async def read_holding_registers(self, address, count, unit_id):
return await self.__client.read_holding_registers(address=address, count=count, slave=unit_id)
return await self.__client.read_holding_registers(address=address, count=count, slave=unit_id) # noqa

@with_lock_for_serial
async def read_input_registers(self, address, count, unit_id):
return await self.__client.read_input_registers(address=address, count=count, slave=unit_id)
return await self.__client.read_input_registers(address=address, count=count, slave=unit_id) # noqa

@with_lock_for_serial
async def write_coil(self, address, value, unit_id):
return await self.__client.write_coil(address=address, value=value, slave=unit_id)
return await self.__client.write_coil(address=address, value=value, slave=unit_id) # noqa

@with_lock_for_serial
async def write_register(self, address, value, unit_id):
return await self.__client.write_register(address=address, value=value, slave=unit_id)
return await self.__client.write_register(address=address, value=value, slave=unit_id) # noqa

@with_lock_for_serial
async def write_coils(self, address, values, unit_id):
return await self.__client.write_coils(address=address, values=values, slave=unit_id)
return await self.__client.write_coils(address=address, values=values, slave=unit_id) # noqa

@with_lock_for_serial
async def write_registers(self, address, values, unit_id):
return await self.__client.write_registers(address=address, values=values, slave=unit_id)
return await self.__client.write_registers(address=address, values=values, slave=unit_id) # noqa

def get_available_functions(self):
return {
Expand Down
2 changes: 1 addition & 1 deletion thingsboard_gateway/gateway/tb_gateway_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@ def __send_rpc_reply(self, device=None, req_id=None, content=None, success_sent=
try:
content = loads(content)
except Exception:
content = {"response": content}
pass
if device is not None and success_sent is not None and not to_connector_rpc:
self.tb_client.client.gw_send_rpc_reply(device, req_id, dumps(rpc_response),
quality_of_service=quality_of_service)
Expand Down

0 comments on commit 2c433a1

Please sign in to comment.