Overview
This node enables interaction with OPC UA (Open Platform Communications Unified Architecture) servers, specifically allowing users to write data or call methods on OPC UA nodes. It supports two main write operations: writing a value to a variable node and invoking a method on an object node.
Common scenarios include:
- Updating sensor or device values in an industrial automation system.
- Triggering actions or commands on OPC UA-enabled devices by calling methods.
- Integrating OPC UA server control into broader workflows for monitoring and control.
For example, you might use this node to set a temperature setpoint on a machine by writing a new value to the corresponding OPC UA variable node, or to start a process by calling a method exposed by the OPC UA server.
Properties
| Name | Meaning |
|---|---|
| Write Operation | Choose whether to write to a variable (Write Variable) or call a method (Call Method). |
If Write Operation is Write Variable:
| Name | Meaning |
|---|---|
| Node ID | The OPC UA nodeId of the variable to write to. |
| Value | The value to write to the specified node. |
| Data Type | The OPC UA data type of the value. Options: Boolean, Byte, ByteString, DateTime, Double, Float, Guid, Int16, Int32, Int64, SByte, String, UInt16, UInt32, UInt64. |
If Write Operation is Call Method:
| Name | Meaning |
|---|---|
| Object Node ID | The nodeId of the object containing the method to call. |
| Method Node ID | The nodeId of the method to invoke. |
| Parameters | Optional input arguments for the method call. Each argument has a data type (same options as above) and a value. Leave empty if no input arguments are needed. |
Output
The node outputs JSON objects describing the result of the write operation or method call. The structure includes:
timestamp: The time when the operation was performed.source: Identifier of the connection source (e.g., connection pool name).protocol: Always"opcua".address: The nodeId or method nodeId involved.metrics: For variable writes, contains the written value keyed by nodeId; for method calls, contains output arguments returned by the method.status:"ok"if the operation succeeded, otherwise"error".meta: Additional metadata including:dataType: The OPC UA data type of the value written (for variable writes).operationType: Either"variable_write"or"method_call".statusCode: The OPC UA status code name returned by the server.- For method calls, also includes the input arguments sent.
The node does not output binary data.
Dependencies
- Requires an OPC UA server accessible via network.
- Needs credentials with appropriate authentication (anonymous, username/password, or X509 certificate).
- Uses an internal connection pool to manage OPC UA client sessions.
- Requires configuration of an API key credential that provides endpoint URL, security policy, security mode, and authentication details.
- Relies on the OPC UA client library bundled within the node's dependencies.
Troubleshooting
- Missing Credentials: If no OPC UA credentials are provided, the node will throw an error. Ensure credentials are configured properly.
- X509 Authentication Errors: When using X509 authentication, both certificate and private key must be supplied; otherwise, an error occurs.
- Invalid Node IDs: Writing or calling methods requires valid OPC UA nodeIds. Empty or malformed nodeIds cause errors.
- Connection Failures: Network issues or incorrect endpoint URLs can cause connection failures. Verify the endpoint URL starts with
opc.tcp://oropc.https://. - Unsupported Operations: Only "writeVariable" and "callMethod" write operations are supported. Selecting unsupported types results in errors.
- Data Type Mismatches: Values are converted to the specified OPC UA data type before writing. Providing incompatible values may lead to unexpected results or errors.
- Server Status Codes: The node reports OPC UA status codes. A status other than "Good" indicates an issue with the operation on the server side.
Links and References
- OPC UA Specification
- n8n Documentation
- OPC UA Client Libraries (used internally by the node)