Skip to content

[BUG] MODBUS Server don't do anything, don't attach to port #1672

@palandri

Description

@palandri

Hello everyone.

Describe the issue
When configuring the MODBUS connector as Server (TCP or Serial), literally nothing happens. tb-gateway don't attach to port, no log message, literally nothing.

If I enable sendDataToThingsBoard, it open/attach to designated port, but start polling, working as a Client, but do not listen on the interface, only sending requests. This behaviour happens both in TCP or Serial mode. In serial, I can see traffic on the bus (the requests being sent by the Server).

I don't think this behaviour is correct... in my understanding, a Modbus Server should listen and respond to requests, not initiate requests to another device (which is the role of the client).

Also, to corroborate with the information shown above, if I ran a Server/Slave simulator on the bus, it answer correctly to the requests, showing (in my understanding) that the connector is indeed working as a Client/Master.

OTOH, running a Client/Master simulator on the bus, it keeps timing out, or gives a checksum error (I suppose when the requests conflict between the Simulator and the Server/Slave Connector (which is bad behaving as a Client/Master).

Before enabling sendDataToThingsBoard
Image

After enabling sendDataToThingsBoard (no restart, only enabling)
Image

Slave simulator answering the requests of the "Server"
Image

Master simulator timing out/giving error
Image

Configuration (Attach your configuration file)

{
"thingsboard": {
"host": "redacted",
"port": redacted,
"remoteShell": false,
"remoteConfiguration": true,
"latencyDebugMode": false,
"statistics": {
"enable": true,
"statsSendPeriodInSeconds": 3600
},
"deviceFiltering": {
"enable": false,
"filterFile": "list.json"
},
"maxPayloadSizeBytes": 8196,
"minPackSendDelayMS": 50,
"minPackSizeToSend": 500,
"checkConnectorsConfigurationInSeconds": 60,
"handleDeviceRenaming": true,
"security": {
"type": "accessToken",
"accessToken": "redacted"
},
"qos": 1,
"reportStrategy": {
"type": "ON_RECEIVED"
},
"checkingDeviceActivity": {
"checkDeviceInactivity": false,
"inactivityTimeoutSeconds": 300,
"inactivityCheckPeriodSeconds": 10
},
"rateLimits": "DEFAULT_TELEMETRY_RATE_LIMIT",
"dpRateLimits": "DEFAULT_TELEMETRY_DP_RATE_LIMIT",
"messagesRateLimits": "DEFAULT_MESSAGES_RATE_LIMIT",
"deviceMessagesRateLimits": "DEFAULT_MESSAGES_RATE_LIMIT",
"deviceRateLimits": "DEFAULT_TELEMETRY_RATE_LIMIT",
"deviceDpRateLimits": "DEFAULT_TELEMETRY_DP_RATE_LIMIT",
"ts": 1738785615970
},
"storage": {
"type": "memory",
"read_records_count": 100,
"max_records_count": 100000,
"data_folder_path": "./data/",
"max_file_count": 10,
"max_read_records_count": 10,
"max_records_per_file": 10000,
"data_file_path": "./data/data.db",
"messages_ttl_check_in_hours": 1,
"messages_ttl_in_days": 7,
"ts": 1738785615970
},
"grpc": {
"enabled": false,
"serverPort": 9595,
"keepAliveTimeMs": 10001,
"keepAliveTimeoutMs": 5000,
"keepAlivePermitWithoutCalls": true,
"maxPingsWithoutData": 0,
"minTimeBetweenPingsMs": 10000,
"minPingIntervalWithoutDataMs": 5000
},
"connectors": [
{
"type": "modbus",
"name": "Slave Connector",
"configuration": "slaveConnector.json"
}
]
}

Connector name (If you need help with some connector/converter):
MODBUS Connector

{
"master": {
"slaves": []
},
"name": "Slave Connector",
"id": "c45419da-fb11-4889-bb77-77f8153a3f21",
"slave": {
"type": "serial",
"method": "rtu",
"unitId": 100,
"baudrate": 9600,
"deviceName": "redacted",
"deviceType": "default",
"pollPeriod": 0,
"sendDataToThingsBoard": false,
"byteOrder": "LITTLE",
"wordOrder": "LITTLE",
"identity": {
"vendorName": "redacted",
"productCode": "redacted",
"vendorUrl": "redacted",
"productName": "redacted",
"modelName": "redacted"
},
"values": {
"holding_registers": {
"attributes": [],
"timeseries": [
{
"tag": "teste",
"value": "0",
"type": "bytes",
"address": 2,
"objectsCount": 1
}
],
"attributeUpdates": [],
"rpc": []
},
"coils_initializer": {
"attributes": [],
"timeseries": [],
"attributeUpdates": [],
"rpc": []
},
"input_registers": {
"attributes": [],
"timeseries": [],
"attributeUpdates": [],
"rpc": []
},
"discrete_inputs": {
"attributes": [
{
"tag": "input",
"value": "12",
"type": "bytes",
"address": 2,
"objectsCount": 1
}
],
"timeseries": [],
"attributeUpdates": [],
"rpc": []
}
},
"port": "/dev/ttyS0"
},
"logLevel": "TRACE",
"enableRemoteLogging": false,
"configVersion": "3.6.3"
}

Versions (please complete the following information):

  • OS: RaspberryOS, tb-gateway running on Docker
  • Thingsboard IoT Gateway version: 3.7.0

--- the TL;DR is: Modbus Server don't act as a Server, but as a Client

Help please :)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions