Closed santobedi closed 2 years ago
Hi @santobedi, send, please, your Modbus config file. Thanks for your interest in ThingsBoard IoT Gateway!
Hello @samson0v, Following in my Modbus config file.
{
"master": {
"slaves": [
{
"unitId": 150,
"deviceName": "energy_meter_electrical_1p_1_1a",
"attributesPollPeriod": 5000,
"timeseriesPollPeriod": 5000,
"sendDataOnlyOnChange": false,
"connectAttemptTimeMs": 5000,
"connectAttemptCount": 5,
"waitAfterFailedAttemptsMs": 300000,
"attributes": [
{
"tag": "Vendor_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 16,
"address": 31044
},
{
"tag": "RF-ID",
"type": "string",
"functionCode": 4,
"objectsCount": 4,
"address": 31026
},
{
"tag": "Product_Code",
"type": "string",
"functionCode": 4,
"objectsCount": 16,
"address": 31060
},
{
"tag": "Firmware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31076
},
{
"tag": "Hardware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31082
},
{
"tag": "Serial_Number",
"type": "string",
"functionCode": 4,
"objectsCount": 10,
"address": 31088
},
{
"tag": "Asset_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 10,
"address": 50
},
{
"tag": "Label",
"type": "string",
"functionCode": 4,
"objectsCount": 3,
"address": 31010
}
],
"timeseries": [
{
"tag": "current_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 2999
},
{
"tag": "voltage_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3027
},
{
"tag": "active_power",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3059,
"divider": 1000
},
{
"tag": "power_factor",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3083
},
{
"tag": "active_energy_import",
"type": "64int",
"functionCode": 3,
"objectsCount": 4,
"address": 3203,
"divider": 1000
}
],
"attributeUpdates": [
{
"tag": "shared_attribute_write",
"type": "32int",
"functionCode": 6,
"objectsCount": 2,
"address": 29
}
],
"rpc": [
{
"tag": "setValue",
"type": "bits",
"functionCode": 5,
"objectsCount": 1,
"address": 31
},
{
"tag": "getValue",
"type": "bits",
"functionCode": 1,
"objectsCount": 1,
"address": 31
},
{
"tag": "setCPUFanSpeed",
"type": "32int",
"functionCode": 16,
"objectsCount": 2,
"address": 33
},
{
"tag": "getCPULoad",
"type": "32int",
"functionCode": 4,
"objectsCount": 2,
"address": 35
}
],
"host": "10.0.1.244",
"port": 502,
"type": "tcp",
"method": "socket",
"timeout": 35,
"byteOrder": "BIG",
"wordOrder": null,
"retries": null,
"retryOnEmpty": null,
"retryOnInvalid": null,
"baudrate": null,
"pollPeriod": 5000
},
{
"unitId": 151,
"deviceName": "energy_meter_electrical_1p_1_2a",
"attributesPollPeriod": 5000,
"timeseriesPollPeriod": 5000,
"sendDataOnlyOnChange": false,
"connectAttemptTimeMs": 5000,
"connectAttemptCount": 5,
"waitAfterFailedAttemptsMs": 300000,
"attributes": [
{
"tag": "Vendor_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 16,
"address": 31044
},
{
"tag": "RF-ID",
"type": "string",
"functionCode": 4,
"objectsCount": 4,
"address": 31026
},
{
"tag": "Product_Code",
"type": "string",
"functionCode": 4,
"objectsCount": 16,
"address": 31060
},
{
"tag": "Firmware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31076
},
{
"tag": "Hardware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31082
},
{
"tag": "Serial_Number",
"type": "string",
"functionCode": 4,
"objectsCount": 10,
"address": 31088
},
{
"tag": "Asset_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 10,
"address": 50
},
{
"tag": "Label",
"type": "string",
"functionCode": 4,
"objectsCount": 3,
"address": 31010
}
],
"timeseries": [
{
"tag": "current_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 2999
},
{
"tag": "voltage_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3027
},
{
"tag": "active_power",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3059,
"divider": 1000
},
{
"tag": "power_factor",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3083
},
{
"tag": "active_energy_import",
"type": "64int",
"functionCode": 3,
"objectsCount": 4,
"address": 3203,
"divider": 1000
}
],
"attributeUpdates": [
{
"tag": "shared_attribute_write",
"type": "32int",
"functionCode": 6,
"objectsCount": 2,
"address": 29
}
],
"rpc": [
{
"tag": "setValue",
"type": "bits",
"functionCode": 5,
"objectsCount": 1,
"address": 31
},
{
"tag": "getValue",
"type": "bits",
"functionCode": 1,
"objectsCount": 1,
"address": 31
},
{
"tag": "setCPUFanSpeed",
"type": "32int",
"functionCode": 16,
"objectsCount": 2,
"address": 33
},
{
"tag": "getCPULoad",
"type": "32int",
"functionCode": 4,
"objectsCount": 2,
"address": 35
}
],
"host": "10.0.1.244",
"port": 502,
"type": "tcp",
"method": "socket",
"timeout": 35,
"byteOrder": "BIG",
"wordOrder": null,
"retries": null,
"retryOnEmpty": null,
"retryOnInvalid": null,
"baudrate": null,
"pollPeriod": 5000
},
{
"unitId": 152,
"deviceName": "energy_meter_electrical_3p_1_3a",
"attributesPollPeriod": 5000,
"timeseriesPollPeriod": 5000,
"sendDataOnlyOnChange": false,
"connectAttemptTimeMs": 5000,
"connectAttemptCount": 5,
"waitAfterFailedAttemptsMs": 300000,
"attributes": [
{
"tag": "Vendor_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 16,
"address": 31044
},
{
"tag": "RF-ID",
"type": "string",
"functionCode": 4,
"objectsCount": 4,
"address": 31026
},
{
"tag": "Product_Code",
"type": "string",
"functionCode": 4,
"objectsCount": 16,
"address": 31060
},
{
"tag": "Firmware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31076
},
{
"tag": "Hardware_Revision",
"type": "string",
"functionCode": 4,
"objectsCount": 6,
"address": 31082
},
{
"tag": "Serial_Number",
"type": "string",
"functionCode": 4,
"objectsCount": 10,
"address": 31088
},
{
"tag": "Asset_Name",
"type": "string",
"functionCode": 3,
"objectsCount": 10,
"address": 50
},
{
"tag": "Label",
"type": "string",
"functionCode": 4,
"objectsCount": 3,
"address": 31010
}
],
"timeseries": [
{
"tag": "current_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 2999
},
{
"tag": "voltage_phase_1",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3027
},
{
"tag": "active_power",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3059,
"divider": 1000
},
{
"tag": "power_factor",
"type": "32float",
"functionCode": 4,
"objectsCount": 2,
"address": 3083
},
{
"tag": "active_energy_import",
"type": "64int",
"functionCode": 3,
"objectsCount": 4,
"address": 3203,
"divider": 1000
}
],
"attributeUpdates": [
{
"tag": "shared_attribute_write",
"type": "32int",
"functionCode": 6,
"objectsCount": 2,
"address": 29
}
],
"rpc": [
{
"tag": "setValue",
"type": "bits",
"functionCode": 5,
"objectsCount": 1,
"address": 31
},
{
"tag": "getValue",
"type": "bits",
"functionCode": 1,
"objectsCount": 1,
"address": 31
},
{
"tag": "setCPUFanSpeed",
"type": "32int",
"functionCode": 16,
"objectsCount": 2,
"address": 33
},
{
"tag": "getCPULoad",
"type": "32int",
"functionCode": 4,
"objectsCount": 2,
"address": 35
}
],
"host": "10.0.1.244",
"port": 502,
"type": "tcp",
"method": "socket",
"timeout": 35,
"byteOrder": "BIG",
"wordOrder": null,
"retries": null,
"retryOnEmpty": null,
"retryOnInvalid": null,
"baudrate": null,
"pollPeriod": 5000
}
]
},
"slave": null
}
@samson0v On the MQTT connector within the same IoT gateway (device: raspberry pi 3, Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-1050-raspi armv7l) ), the attribute is fine and updated. However, telemetry is not.
Hi @santobedi, can you, please, write steps to reproduce the bug and also send the registers data (using for example modpoll).
Hello @samson0v ,
The Modbus TCP power tags are from Schneider. Attached herewith are the screenshots of Telemetry from Gateway device and one of the Modbus power tags. I've noticed that the time shown in Logs of Gateway is same as the time displayed as last time update
of the Modbus device (devices created by the gateway in the TB). This last time update
is not real time. Whereas the time and values displayed in the attribute section are fine.
Moreover, in the case of the MQTT connector, the values (time-series telemetry and attributes) are fine but the last time update
in the telemetry is wrong similar to the Modbus connector.
@santobedi it seems that your system use the wrong time and it is not a Gateway bug because it uses a system date and time.
@samson0v What about the wrong telemetry? And the raised error?
@santobedi, can you, please, write steps to reproduce the error, wrong telemetry and also send the registers data (using for example modpoll). Thanks!
@samson0v , I installed the gateway from source. Configured thetb_gateway.yaml
,modbus.json
, and mqtt.json
(/home/myDevice/thingsboard-gateway/thingsboard_gateway/config/), then ran python3 ./thingsboard_gateway/tb_gateway.py
command. After this, the devices are created in the TB.
The wrong telemetry from one of the devices (created in TB via the gateway) is shown in the attached screenshot. I've attached the screenshot showing the client attribute (which has no issue at all) of the same device for your reference. If it's due to the system time, how come it affects only Telemetry, but not the Attributes? At this moment, I could not run the modpoll in our device (deployed in distance location), however, the same device had no such issues before (the earlier version of the gateway).
Hi @santobedi, is this bug still actual for you?
Hello @samson0v ,
I have not experienced such bugs lately.
Hello @samson0v, @imbeacon,
The same issue occurred again. For the devices created through the MQTT connector, only the attribute gets updated, Telemetry does not. This time the gateway is DEB.
Hi @samson0v , @imbeacon ,
This time, the issue occurred when the same MQTT config file (that results in the same virtual devices) has been used for two different gateways (although only one gateway is present in the server and in practice) connecting to the same TB server. In other words, the attempt to update (with telemetry) already existing virtual devices (those were created from the old gateway) with the new gateway caused the issue. Removing all those devices including the gateway from the server, reinstalling the gateway, and several attempts of rebooting the gateway device finally solved the issue.
Describe the issue Random value (unexpected) as telemetry while using Modbus connector. The Last Update Time always toggles with fixed past times. However, everything is fine with the Attributes (Client).
Connector name (If you need help with some connector/converter): Modbus Connector
Error traceback (If it was raised):
Versions (please complete the following information):