0

this is my Configuration File. I'm using the new profile https://thingsboard.io/docs/iot-gateway/config/modbus/ [new_modbus.json], in the new configuration file, seems to be able to configure several different devices in { master : { "slaves" : [] }}. And when I do, I couldn't get the right results.

{
    "master":{
        "slaves":[
            {
                "unitId":1,
                "deviceName":"test1",
                "attributesPollPeriod":5000,
                "timeseriesPollPeriod":5000,
                "sendDataOnlyOnChange":false,
                "attributes":[
                    {
                        "byteOrder":"BIG",
                        "tag":"temperature",
                        "type":"bytes",
                        "functionCode":3,
                        "registerCount":1,
                        "address":1
                    }
                ],
                "timeseries":[
                    {
                        "tag":"distance",
                        "type":"bytes",
                        "functionCode":3,
                        "objectsCount":1,
                        "address":2
                    }
                ],
                "attributeUpdates":[
                    {
                        "tag":"shared_value_1",
                        "type":"32uint",
                        "functionCode":6,
                        "objectsCount":2,
                        "address":3
                    },
                    {
                        "tag":"shared_value_2",
                        "type":"32uint",
                        "functionCode":6,
                        "objectsCount":2,
                        "address":4
                    }
                ],
                "rpc":[
                    {
                        "tag":"bearing_bpfo",
                        "type":"32uint",
                        "functionCode":6,
                        "objectsCount":2,
                        "address":5
                    }
                ],
                "host":null,
                "port":"/dev/ttyUSB0",
                "type":"serial",
                "method":"rtu",
                "timeout":35,
                "byteOrder":"BIG",
                "wordOrder":"BIG",
                "retries":null,
                "retryOnEmpty":null,
                "retryOnInvalid":null,
                "baudrate":9600,
                "pollPeriod":5000,
                "connectAttemptCount":1
            },
            {
                "unitId":2,
                "deviceName":"Test2",
                "attributesPollPeriod":5000,
                "timeseriesPollPeriod":5000,
                "sendDataOnlyOnChange":false,
                "attributes":[
                    {
                        "byteOrder":"BIG",
                        "tag":"temperature",
                        "type":"bytes",
                        "functionCode":3,
                        "registerCount":1,
                        "address":10
                    }
                ],
                "timeseries":[
                    {
                        "tag":"distance",
                        "type":"bytes",
                        "functionCode":3,
                        "objectsCount":1,
                        "address":11
                    }
                ],
                "attributeUpdates":[
                    {
                        "tag":"shared_value_1",
                        "type":"32uint",
                        "functionCode":6,
                        "objectsCount":2,
                        "address":12
                    }
                ],
                "host":null,
                "port":"/dev/ttyUSB0",
                "type":"serial",
                "method":"rtu",
                "timeout":35,
                "byteOrder":"BIG",
                "wordOrder":"BIG",
                "retries":null,
                "retryOnEmpty":null,
                "retryOnInvalid":null,
                "baudrate":9600,
                "pollPeriod":5000,
                "connectAttemptCount":5
            }
        ]
    },
    "slave":null
}

The Connector name I am using is the Modbus Connector, and the version information for my deployment is as follows:
OS: Raspberry Pi
Thingsboard IoT Gateway version : 3.0.1
Python version : 3.9.2

Error traceback:

    ""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 87 - datatype: telemetry   key: distance   value: None"
    ""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 92 - {'deviceName': 'testUpdate', 'deviceType': 'default', 'telemetry': [], 'attributes': []}"
    ""2022-05-11 15:28:10" - |ERROR| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 83 - Modbus Error: [Input/Output] device reports readiness to read but returned no data (device disconnected or multiple access on port?)"
    NoneType: None
    ""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 87 - datatype: telemetry   key: distance   value: None"
    ""2022-05-11 15:28:10" - |DEBUG| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 92 - {'deviceName': 'RpcTest', 'deviceType': 'default', 'telemetry': [], 'attributes': []}"
    ""2022-05-11 15:28:10" - |ERROR| - [bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 83 - Modbus Error: [Input/Output] device reports readiness to read but returned no data (device disconnected or multiple access on port?)"
    NoneType: None
lanruo
  • 1
  • 1
  • Hello and welcome to SO. Some questions: do you really have two slaves with the right IDs (1 and 2) connected to your `/dev/ttyUSB0` serial port? Have you checked they are properly wired? What are the slaves? Are you sure the addresses your are reading are correct and the ones you are writing are not protected? – Marcos G. May 14 '22 at 19:43
  • @ Marcos G. Thanks for your reply. I have already solved this problem. – lanruo May 30 '22 at 01:58

0 Answers0