Modbus Write Points Node
x/modbusWrite component: v0.37.0+ batch-writes Modbus points over TCP/RTU, using industry-standard Modicon traditional addresses. Routes to Success/Failure.
Unlike the imperative x/modbus (single Cmd/Address/Quantity), this component is point-table oriented and shares the same point structure and connection config as x/modbusRead.
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 write 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 |
| 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 |
| value | Write value (string form, e.g. "23.5", "true", "0x1F"), supports ${msg.xx} templates |
| endian | Multi-register byte order: ABCD/CDAB/BADC/DCBA |
All fields support ${msg.xx} / ${metadata.xx} templates.
# Write Rules
- Read-only areas rejected:
10001(Discrete Input) /30001(Input Register) are read-only; writes fail - BOOL writes only to Coil:
BOOLtype can only write00001(Coil); registers have no atomic bit-write - Multi-register types:
UINT32/INT32/FLOAT32/UINT64/INT64/FLOAT64span multiple registers, encoded byendian
# Input/Output
- Input:
msg.Datawith point list[{"name","addr","type","value"}](takes precedence over configured points) - Output: Success/Failure (any point failure fails the batch)
# Example
Configured default write points:
{
"id": "modbus_write",
"type": "x/modbusWrite",
"configuration": {
"server": "tcp://192.168.1.100:502",
"unitId": 1,
"points": [
{"name": "setpoint", "addr": "40010", "type": "FLOAT32", "value": "${msg.targetTemp}"},
{"name": "motor", "addr": "00001", "type": "BOOL", "value": "true"}
]
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
On-demand write (msg.Data with point list, takes precedence):
[{"name": "setpoint", "addr": "40010", "type": "FLOAT32", "value": "50.5"}]
1
# Related
- Read: x/modbusRead
- Universal write entry: x/iotWrite (driver=modbus)
- Imperative (legacy): x/modbus (kept)
Edit this page on GitHub (opens new window)
Last Updated: 2026/07/29, 07:07:39