EtherNet/IP Write
x/eipWrite component: v0.37.0+ Writes tag values in batch to Rockwell Automation Allen-Bradley ControlLogix/CompactLogix/Micro820 PLCs over the EtherNet/IP (CIP) protocol. Only CIP devices are supported; PCCC protocol devices such as PLC5, SLC, and MicroLogix are not supported.
Additional extension library required: rulego-components-iot (opens new window)
# Configuration
| Field | Type | Description | Default |
|---|---|---|---|
| server | string | PLC host address (host only); port 44818 is built in by gologix, e.g. 127.0.0.1; supports ref://nodeId to reuse an existing connection in the chain | 127.0.0.1 |
| slot | int | CPU slot on the backplane; auto-generates the CIP path (e.g. 1,0) | 0 |
| path | string | Optional CIP path override, e.g. 1,0; empty = auto-generated from slot | None |
| timeout | int | Request timeout in seconds | 5 |
| points | array | Default points table; points in msg.Data take precedence | None |
Points fields:
| Field | Type | Description |
|---|---|---|
| name | string | Point name |
| addr | string | Controller tag name (CIP tag), e.g. MyTag, MyDB.Temperature |
| type | string | Tag data type, required (gologix Write needs an explicit type to encode the value); see options below |
| value | string | Value to write (as a string); supports ${msg.xx} template variables |
| scale | float | Optional scale multiplier (default 1); conversion formula eng = raw*scale + offset |
| offset | float | Optional offset (default 0) |
# Point Fields
addr: Controller tag name. Supports controller-scoped tags (e.g. Temperature), struct members (e.g. MyDB.Temperature), array elements (e.g. MyArray[0]), and program-scoped tags (e.g. Program:MainProgram.Tag).
type: Tag data type, required. gologix Write needs an explicit type pointer to encode the value correctly; it cannot be inferred automatically.
Supported values (case-insensitive):
| Category | Accepted aliases |
|---|---|
| Boolean | BOOL (value accepts true/false/0/1) |
| 8-bit integer | BYTE, SINT, USINT |
| 16-bit integer | INT, INT16, UINT, WORD, UINT16 |
| 32-bit integer | DINT, INT32, UDINT, DWORD, UINT32 |
| 64-bit integer | LINT, INT64, ULINT, UINT64 |
| 32-bit float | REAL, FLOAT |
| 64-bit float | LREAL, DOUBLE |
| String | STRING |
value: The value to write, in string form. Integers accept decimal and 0x hexadecimal prefixes; booleans accept true/false/0/1; floats are parsed by Go's standard rules.
# Input
The list of points to write is read from msg.Data in the format below; when non-empty it takes precedence over the configured points:
[
{"addr": "MyDB.Setpoint", "type": "REAL", "value": "50.5"},
{"addr": "MyDB.Running", "type": "BOOL", "value": "true"},
{"addr": "MyDB.Count", "type": "DINT", "value": "${msg.counter}"}
]
2
3
4
5
value supports ${msg.xx} / ${metadata.xx} template variables, making it easy to write dynamically based on upstream messages.
# Features
- Periodic writes: Pair with an
endpoint/scheduleendpoint upstream as a trigger; maintain points in thepointsconfiguration. - Template variables: Point fields (
name/addr/type/value) support${msg.xx}/${metadata.xx}placeholders. - Dynamic points: Points in
msg.Datatake precedence over configuredpoints. - Same-chain connection pool: Other nodes in the same chain can borrow the EtherNet/IP connection already established by this node via
ref://nodeId, avoiding duplicate connections. - Auto-reconnect & retry: On write failure the node reconnects and retries automatically, up to
3times.
# Relation Type
- Success: On successful execution, the message is sent to the
Successchain. - Failure: On failed execution, the message is sent to the
Failurechain.
# Execution Result
Does not change the message payload.
# Example
{
"ruleChain": {
"name": "eip-write-demo",
"root": true,
"debugMode": false
},
"metadata": {
"endpoints": [],
"nodes": [
{
"type": "x/eipWrite",
"name": "write tags",
"debugMode": false,
"configuration": {
"server": "192.168.1.10",
"slot": 0,
"timeout": 5,
"points": [
{"name": "setpoint", "addr": "MyDB.Setpoint", "type": "REAL", "value": "50.5"},
{"name": "running", "addr": "MyDB.Running", "type": "BOOL", "value": "true"}
]
}
}
],
"connections": []
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27