thingsboard / thingsboard-gateway

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
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.68k stars 817 forks source link

[HELP] Modbus RTU data transmission problem #1451

Open Crissbenavides opened 1 month ago

Crissbenavides commented 1 month ago

Describe the issue I have ThingsBoard Gateway installed on a Raspberry Pi 4 with 8GB of RAM, to which I have connected a serial device that measures the temperature through three thermocouples (I send the temperature of these three sensors). The problem arises when I use the Modbus connector: the data transmission works correctly for about 30 minutes or so, but then stops. I have checked the ThingsBoard Gateway logs and I can't find any error message to help me understand what is going on. When I run the command "systemctl restart thingsboard-gateway", the system starts working correctly again, but after about 30 minutes, the transmission stops again.

As a bonus, this problem also happened to me when I installed tb gateway in a virtual machine with ubuntu.

Last but not least, I am using the 30 day trial version of Thingsboard cloud.

Configuration { "thingsboard": { "host": "mqtt.thingsboard.cloud", "port": 1883, "remoteShell": false, "remoteConfiguration": true, "statistics": { "enable": true, "statsSendPeriodInSeconds": 3600 }, "deviceFiltering": { "enable": false, "filterFile": "list.json" }, "maxPayloadSizeBytes": 1024, "minPackSendDelayMS": 200, "minPackSizeToSend": 500, "checkConnectorsConfigurationInSeconds": 60, "handleDeviceRenaming": true, "security": { "type": "accessToken", "accessToken": "" }, "qos": 1, "checkingDeviceActivity": { "checkDeviceInactivity": false, "inactivityTimeoutSeconds": 200, "inactivityCheckPeriodSeconds": 500 }, "ts": 1720023134547, "rateLimits": "DEFAULT_RATE_LIMIT", "dpRateLimits": "DEFAULT_RATE_LIMIT" }, "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": 1720023134547 }, "grpc": { "enabled": false, "serverPort": 9595, "keepaliveTimeMs": 10000, "keepaliveTimeoutMs": 5000, "keepalivePermitWithoutCalls": true, "maxPingsWithoutData": 0, "minTimeBetweenPingsMs": 10000, "minPingIntervalWithoutDataMs": 5000, "keepAliveTimeMs": 10000, "keepAliveTimeoutMs": 5000 }, "connectors": [ { "type": "modbus", "name": "Modbus", "configuration": "modbus.json" } ] }

Connector name: [Modbus Connector] { "master": { "slaves": [ { "type": "serial", "method": "rtu", "port": "/dev/ttyUSB0", "baudrate": 9600, "timeout": 6000, "stopbits": 1, "bytesize": 8, "byteOrder": "BIG", "wordOrder": "BIG", "retries": true, "retryOnEmpty": true, "retryOnInvalid": true, "pollPeriod": 5000, "unitId": 2, "deviceName": "M-7019R_RTU", "sendDataOnlyOnChange": false, "connectAttemptTimeMs": 5000, "connectAttemptCount": 5, "waitAfterFailedAttemptsMs": 300000, "attributes": [], "timeseries": [ { "tag": "Termopar1", "type": "16uint", "functionCode": 4, "objectsCount": 1, "address": 0, "divider": 10 }, { "tag": "Termopar2", "type": "16uint", "functionCode": 4, "objectsCount": 1, "address": 1, "divider": 10 }, { "tag": "Termopar3", "type": "16uint", "functionCode": 4, "objectsCount": 1, "address": 2, "divider": 10 } ], "attributeUpdates": [], "rpc": [] } ] } }

Error traceback (If it was raised):

Versions:

imbeacon commented 1 month ago

Hi @Crissbenavides,

Could you set logging level to DEBUG and after encountering the issue send logs to us (service log, tb_connection log and connector log files)? It will be helpful for investigation.