thingsboard-gateway icon indicating copy to clipboard operation
thingsboard-gateway copied to clipboard

[BUG] Multidrop Modbus RTU not possible in "new configuration"

Open Bliph opened this issue 3 years ago • 2 comments

Describe the bug It is not possible to configure more than 1 slave per serial port when setting up Modbus RTU. Specifically, different slaves cannot have the same port configured. It seems to be impossible to configure "multi-drop" modbus devices connected to the same serial port with different unitId

Connector name (If bug in the some connector): Modbus RTU connector

Error traceback (If available):

[bytes_modbus_uplink_converter.py] - bytes_modbus_uplink_converter - convert - 82 - Modbus Error: [Input/Output] device reports readiness to read but returned no data (device disconnected or multiple access on port?)"
NoneType: None

Versions (please complete the following information):

  • OS: [Raspbian GNU/Linux 10 (buster)]
  • Thingsboard IoT Gateway version [3.0.1]
  • Python version [3.7.3]

Example of failing configuration:

{ 
  "master": {
    "slaves": [
      {
        "unitId": 1,
        "deviceName": "Meter_1",
        "attributes": [],
        "timeseries": [
          {
            "tag": "voltage",
            "type": "32float",
            "functionCode": 4,
            "objectsCount": 2,
            "address": 0
          }
        ],
        "port": "/dev/ttySC0",
        "type": "serial",
        "sendDataOnlyOnChange": false,
        "method": "rtu",
        "timeout": 35,
        "byteOrder": "BIG",
        "wordOrder": "BIG",
        "strict": true,
        "retries": null,
        "retryOnEmpty": null,
        "retryOnInvalid": null,
        "baudrate": 9600,
        "pollPeriod": 5000
      },
      {
        "unitId": 2,
        "deviceName": "Meter_2",
        "attributes": [],
        "timeseries": [
          {
            "tag": "voltage",
            "type": "32float",
            "functionCode": 4,
            "objectsCount": 2,
            "address": 0
          }
        ],
        "port": "/dev/ttySC0",
        "type": "serial",
        "sendDataOnlyOnChange": false,
        "method": "rtu",
        "timeout": 35,
        "byteOrder": "BIG",
        "wordOrder": "BIG",
        "strict": true,
        "retries": null,
        "retryOnEmpty": null,
        "retryOnInvalid": null,
        "baudrate": 9600,
        "pollPeriod": 5000
      }
    ]
  }
}

Bliph avatar Mar 01 '22 15:03 Bliph

My little thought:

  1. Determine if your slave device id is the same (for example, my own devices default id is 1, so I need to modify the device id to a different value first)
  2. You can delete the empty array and try again, I also have the same problem, When I delete the empty array("attributes": []) and do not report the error.

Lanruo555 avatar May 20 '22 03:05 Lanruo555

Hi, Did you solve this? Do you have a configuration that works with just 1 device?

PaulHHolmes avatar Jun 24 '22 16:06 PaulHHolmes