OPC_UA Write
x/opcuaWrite Component: v0.28.0+ OPC UA Write component, used to write data to one or multiple OPC UA nodes.
Additional extension library required: rulego-components-iot (opens new window)
# Configuration
| Field | Type | Description | Default |
|---|---|---|---|
| server | string | OPC UA server address; supports ref:// to reuse a connection within the same chain | None |
| policy | string | Security policy, options include: None, Basic128Rsa15, Basic256, Basic256Sha256 | None |
| mode | string | Communication mode, options include: None, Sign, SignAndEncrypt | None |
| auth | string | Authentication method, options: Anonymous, UserName, Certificate | Anonymous |
| username | string | Username (required when auth is UserName) | None |
| password | string | Password (required when auth is UserName) | None |
| certFile | string | Certificate file path (required when auth is Certificate) | None |
| certKeyFile | string | Private key file path (required when auth is Certificate) | None |
| points | array | Point list (standard write method); each item has addr/type/value, addr = OPC UA NodeID | None |
Point Fields (points array element):
| Field | Type | Description |
|---|---|---|
| addr | string | OPC UA NodeID, e.g. ns=2;s=Temperature |
| type | string | Data type, unified enum BOOL/INT16/UINT16/INT32/UINT32/INT64/UINT64/FLOAT32/FLOAT64/STRING |
| value | string | Write value (string form, parsed by the driver per type) |
Security Policy (policy) Options Meaning:
- None: No security policy is used.
- Basic128Rsa15: Uses basic 128-bit encryption and RSA15 signing.
- Basic256: Uses basic 256-bit encryption.
- Basic256Sha256: Uses basic 256-bit encryption and SHA256 signing.
Communication Mode (mode) Options Meaning:
- None: No mode is used.
- Sign: Message signing.
- SignAndEncrypt: Message signing and encryption.
Write Points (Standard Method): specified via the points configuration, where addr is the OPC UA NodeID and type uses the unified enum. Format:
[
{"addr": "ns=2;s=Switch", "type": "BOOL", "value": "true"},
{"addr": "ns=2;s=Setpoint", "type": "FLOAT32", "value": "25.5"},
{"addr": "ns=2;s=Count", "type": "INT32", "value": "100"}
]
2
3
4
5
Legacy Compatibility: you may also pass a nodeId/value/dataType structure via the message payload msg.Data (kept for backward compatibility only; points is recommended). Format:
[
{
"nodeId": "ns=3;i=1009",
"value": 1
},
{
"nodeId": "ns=3;i=1010",
"value": 2,
"dataType": "Int32"
},
{
"nodeId": "ns=3;i=1011",
"value": [1.1, 2.2, 3.3],
"dataType": "Double"
}
]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DataType Description (legacy msg.Data method only):
If dataType is not specified, it is inferred from the type of value (numbers default to Double).
Available options include:
- Boolean
- SByte, Byte
- Int16, UInt16
- Int32, UInt32
- Int64, UInt64
- Float, Double
- String
- DateTime (format:2006-01-02T15:04:05Z07:00)
Supports array writing. When value is an array, it is automatically converted to an array of the corresponding type.
# Relation Type
- Success: Execution is successful, the message is sent to the
Successchain. - Failure: Execution fails, the message is sent to the
Failurechain.
# Execution Result
The message payload value remains unchanged.