Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] conflict between modbus tcp and modbus serial connectors when used together #1524

Open
Tunahan0155 opened this issue Sep 13, 2024 · 0 comments
Assignees
Labels

Comments

@Tunahan0155
Copy link

Describe the bug
When I use modbus tcp and modbus serial together in thingsboard gateway, these two connectors conflict with each other, the names of the two are different but still, depending on the time, In the thingsboard interface, the "connectorName" attribute became sometimes modbus_serial modbus modbus_tcp, I think this bug is caused by the fact that both connectors are modbus type.

I added the two connectors in the tb_gateway.json file like this;
tb_gateway.json

  "connectors": [
   {
      "id": 0,
      "useGRPC": true,
      "type": "modbus",
      "name": "modbus_serial",
      "configuration": "modbus_serial.json"
    },
    {
       "id": 1,
       "useGRPC": true,
      "type": "modbus",
      "name": "modbus_tcp",
      "configuration": "modbus.json"
    }
  ]
}

My modbus.json file is as follows;
modbus.json

{
  "master": {
    "slaves": [
      {
        "host": "gze_tunahan",
        "port": 502,
	"name": "TCP",
        "type": "tcp",
        "method": "socket",
        "timeout": 35,
        "byteOrder": "BIG",
        "wordOrder": "BIG",
        "retries": true,
        "retryOnEmpty": true,
        "retryOnInvalid": true,
        "pollPeriod": 5000,
        "unitId": 14,
        "deviceName": "LAMP15",
	"deviceType": "modbus_tcp",
        "sendDataOnlyOnChange": false,
        "connectAttemptTimeMs": 5000,
        "connectAttemptCount": 5,
        "waitAfterFailedAttemptsMs": 300000,
        "timeseries": [
          {
            "tag": "OUT",
            "type": "16uint",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 300
          },
          {
            "tag": "BOARD_TEMP",
            "type": "16int",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 305
          }
        ],
        "attributes": [
          {
            "tag": "LAMP_VALUE",
            "type": "16uint",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 319
          }
        ],
        "attributeUpdates": [
          {
            "tag": "LAMP_VALUE",
            "type": "16uint",
            "functionCode": 6,
            "objectsCount": 1,
            "address": 319
          }
        ]
      }
    ]
  }
}

and finally my modbus_serial.json file is as follows;
modbus_serial.json

{
  "master": {
    "slaves": [
      {
        "name": "serial",
        "type": "serial",
        "method": "rtu",
        "port": "/dev/ttyUSB0",
        "baudrate": 38400,
        "stopbits": 1,
        "bytesize": 8,
        "parity": "N",
        "strict": false,
        "timeout": 35,
        "byteOrder": "BIG",
        "wordOrder": "BIG",
        "retries": true,
        "retryOnEmpty": true,
        "retryOnInvalid": true,
        "pollPeriod": 5000,
        "unitId": 100,
        "deviceName": "KETAIR200",
        "deviceType": "modbus_serial",
        "sendDataOnlyOnChange": false,
        "connectAttemptTimeMs": 5000,
        "connectAttemptCount": 5,
        "waitAfterFailedAttemptsMs": 300000,
        "timeseries": [
          {
            "tag": "temperature",
            "type": "16int",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 20,
            "divider": 10
          }
        ],
        "attributes": [
          {
            "tag": "SERIAL_PORT_ADDRESS",
            "type": "16uint",
            "functionCode": 3,
            "objectsCount": 1,
            "address": 2045
          }
        ],
        "attributeUpdates": [
          {
            "tag": "SERIAL_PORT_ADDRESS",
            "type": "16uint",
            "functionCode": 6,
            "objectsCount": 1,
            "address": 2045
          }
        ]
      }
    ]
  }
}

Connector name:
modbus tcp and modbus serial

Versions:

  • OS: on raspberry thingsboard installation for python
  • Thingsboard IoT Gateway version = 3.5.1
  • Python version 3.11
@Tunahan0155 Tunahan0155 changed the title [BUG] [BUG] conflict between modbus tcp and modbus serial connectors when used together Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants