Modbus Read Points Node
x/modbusRead component: v0.37.0+ batch-reads Modbus points over TCP/RTU. Results are written back to msg.Data as a list of the unified contract iot_points.Data, routing to Success/Failure.
Unlike the imperative x/modbus (single Cmd/Address/Quantity), this component is point-table oriented, uses the industry-standard Modicon traditional addresses, and produces output consistent with s7/eip/snmp/opcua — ready to feed x/tsdbWrite (with measurement configured) for time-series storage.
Requires the extension library: rulego-components-iot (opens new window)
# Configuration
| Field | Type | Description | Default |
|---|---|---|---|
| server | string | Modbus server address (tcp://host:port or rtu:///dev/ttyUSB0) | tcp://127.0.0.1:502 |
| unitId | uint8 | Slave unit ID | 1 |
| points | array | Default point table (see below). Points in msg.Data take precedence | none |
| tcpConfig | object | TCP config (timeout/certFile/certKeyFile/caFile) | none |
| rtuConfig | object | RTU serial config (speed/dataBits/parity/stopBits) | none |
| encodingConfig | object | Encoding (endianness/wordOrder for multi-register values) | big-endian high-word |
# Point table (points)
| Field | Description |
|---|---|
| name | Point name (becomes the Data name) |
| addr | Modicon address (1-based): 00001=Coil, 10001=Discrete Input, 30001=Input Register, 40001=Holding Register; extended 6-digit 400001+ = Holding Register |
| type | Data type: BOOL/UINT16/INT16/UINT32/INT32/UINT64/INT64/FLOAT32/FLOAT64 |
| scale | Scale factor: engineering = raw × scale + offset |
| offset | Offset |
| endian | Multi-register byte order: ABCD/CDAB/BADC/DCBA |
All fields support ${msg.xx} / ${metadata.xx} templates.
# Output
msg.Data (unified contract, same as s7/eip/snmp/opcua):
[
{"name": "temperature", "value": 23.5, "timestamp": 1789999999000000000},
{"name": "motor", "value": true, "timestamp": 1789999999000000000}
]
2
3
4
# Example
Scheduled acquisition (schedule endpoint in front), points in points:
{
"id": "modbus_read",
"type": "x/modbusRead",
"configuration": {
"server": "tcp://192.168.1.100:502",
"unitId": 1,
"points": [
{"name": "temp", "addr": "40001", "type": "FLOAT32", "scale": 0.1},
{"name": "motor", "addr": "00001", "type": "BOOL"}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
On-demand read (points in msg.Data take precedence):
[{"name": "setpoint", "addr": "40010", "type": "FLOAT32"}]
# Related
- Write: x/modbusWrite
- Universal acquisition entry: x/iotRead
- To time-series storage: x/tsdbWrite (measurement configured)
- Imperative (legacy): x/modbus (kept; output also unified to iot_points.Data)