Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
Describe the bug
I am doing a connection test of the thingsboard IoT Gateway and thingsboard by setting up a modus connector on the Gateway.
When updating the "shared attributes" of "device" in thingsboard, I get an error in some cases.
If the "type" of "attributeUpdates" is set to "16bit" in the modbus.json setting, no error occurs.
"attributeUpdates": [
{
"tag": "shared_attribute_write",
"type": "16int",
"wordOrder": "LITTLE",
"byteOrder": "BIG",
"functionCode": 6,
"objectsCount": 1,
"address": 0
}
],
An error occurs when the "type" of "attributeUpdates" is set to "32bit" or "64bit" in the modbus.json setting.
"attributeUpdates": [
{
"tag": "shared_attribute_write",
"type": "32int",
"wordOrder": "LITTLE",
"byteOrder": "BIG",
"functionCode": 6,
"objectsCount": 2,
"address": 0
}
],
Connector name (If bug in the some connector):
modbus_connector
Error traceback (If available):
""2020-12-21 13:00:16" - ERROR - [modbus_connector.py] - modbus_connector - 345 - required argument is not an integer"
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-2.5.4-py3.7.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 343, in process_rpc_request
response = self.function_to_device(rpc_command_config, rpc_command_config["unitId"])
File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-2.5.4-py3.7.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 298, in __function_to_device
unit=unit_id)
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/client/common.py", line 92, in write_register
return self.execute(request)
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/client/sync.py", line 108, in execute
return self.transaction.execute(request)
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/transaction.py", line 158, in execute
broadcast=broadcast
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/transaction.py", line 228, in _transact
packet = self.client.framer.buildPacket(packet)
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/framer/socket_framer.py", line 206, in buildPacket
data = message.encode()
File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/register_write_message.py", line 42, in encode
packet += struct.pack('>H', self.value)
struct.error: required argument is not an integer
Versions (please complete the following information):
Describe the bug I am doing a connection test of the thingsboard IoT Gateway and thingsboard by setting up a modus connector on the Gateway. When updating the "shared attributes" of "device" in thingsboard, I get an error in some cases.
If the "type" of "attributeUpdates" is set to "16bit" in the modbus.json setting, no error occurs. "attributeUpdates": [ { "tag": "shared_attribute_write", "type": "16int", "wordOrder": "LITTLE", "byteOrder": "BIG", "functionCode": 6, "objectsCount": 1, "address": 0 } ],
An error occurs when the "type" of "attributeUpdates" is set to "32bit" or "64bit" in the modbus.json setting. "attributeUpdates": [ { "tag": "shared_attribute_write", "type": "32int", "wordOrder": "LITTLE", "byteOrder": "BIG", "functionCode": 6, "objectsCount": 2, "address": 0 } ],
Connector name (If bug in the some connector): modbus_connector
Error traceback (If available): ""2020-12-21 13:00:16" - ERROR - [modbus_connector.py] - modbus_connector - 345 - required argument is not an integer" Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-2.5.4-py3.7.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 343, in process_rpc_request response = self.function_to_device(rpc_command_config, rpc_command_config["unitId"]) File "/usr/local/lib/python3.7/dist-packages/thingsboard_gateway-2.5.4-py3.7.egg/thingsboard_gateway/connectors/modbus/modbus_connector.py", line 298, in __function_to_device unit=unit_id) File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/client/common.py", line 92, in write_register return self.execute(request) File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/client/sync.py", line 108, in execute return self.transaction.execute(request) File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/transaction.py", line 158, in execute broadcast=broadcast File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/transaction.py", line 228, in _transact packet = self.client.framer.buildPacket(packet) File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/framer/socket_framer.py", line 206, in buildPacket data = message.encode() File "/home/pi/.local/lib/python3.7/site-packages/pymodbus/register_write_message.py", line 42, in encode packet += struct.pack('>H', self.value) struct.error: required argument is not an integer
Versions (please complete the following information):