Registry / web-framework / node-red-contrib-opcua

node-red-contrib-opcua

JSON →
library0.2.351jsnpmunverified

A Node-RED node collection for OPC UA communication and server functionality, based on the node-opcua library. Current stable version is 0.2.351, released regularly with active maintenance. It provides client nodes to read, write, subscribe, browse, and invoke methods on OPC UA servers, plus server nodes to create variable and method nodes. Key differentiators include tight integration with Node-RED's flow-based programming model and support for complex OPC UA features like subscriptions, monitored items, events, and array index ranges. Compared to generic OPC UA SDKs, it abstracts connection management and message parsing into easy-to-configure nodes.

npm install node-red-contrib-opcua
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-O
N
node-red-contrib-opcua
web-frameworkjavascriptv0.2.351
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpcUa-Client
import the node via Node-RED palette after installation
const OpcUaClient = require('node-red-contrib-opcua')
This is a Node-RED node, not a library. Import is done automatically by Node-RED after npm install.
OpcUa-Item
import the node via Node-RED palette after installation
import { OpcUaItem } from 'node-red-contrib-opcua'
Nodes are registered with Node-RED and appear in the palette. No manual import needed.
OpcUa-Server
import the node via Node-RED palette after installation
const server = require('node-red-contrib-opcua').OpcUaServer
Only install the package; Node-RED handles node registration.

Installation and minimal flow to read an OPC UA variable using OpcUa-Client and OpcUa-Item nodes.

// No code snippets needed - this is a Node-RED node collection. // To use: Install Node-RED, then run: // npm install node-red-contrib-opcua // Then in Node-RED flows, drag OpcUa-Client, OpcUa-Item, OpcUa-Server nodes. // Example flow (JSON) to read a variable: // [{"id":"n1","type":"OpcUa-Item","name":"example-item","topic":"ns=2;s=MyVariable","datatype":"Int32"}, // {"id":"n2","type":"OpcUa-Client","name":"example-client","endpoint":"opc.tcp://localhost:4840","action":"read","items":["n1"]}, // {"id":"n3","type":"inject","name":"trigger","topic":"","payload":"","repeat":"","crontab":"",once":false}, // {"id":"n4","type":"debug","name":"output"}, // {"id":"n3","wires":[["n2"]]}, {"id":"n2","wires":[["n4"]]}]
Debug
Known issues
breakingFrom v0.2.223, namespace index used with variables for set value; flows using older version may need adjustment.
fix
Update to v0.2.223+ and ensure variable nodes have correct namespace index.
affects: <0.2.223
deprecatedThe node-opcua library has undergone major API changes; some deprecated methods may cause warnings.
fix
Update to latest node-opcua and this package, check node-opcua migration guides.
affects: >=0.2.300
gotchaPayload must include both nodeId and datatype in topic field for read/write operations.
fix
Format topic as 'ns=<namespace>;s=<identifier>;datatype=<DataType>' (e.g., 'ns=3;s=Counter;datatype=Int32').
affects: all
breakingNode.js 15 minimum required (engines field). Older Node.js versions may cause installation failures.
fix
Upgrade Node.js to version 15 or later.
affects: >=0.2.0
gotchaFirewall blocks: OPC UA uses dynamic ports for discovery; ensure network allows OPC UA TCP (port 4840 by default) and discovery endpoints.
fix
Configure firewall to allow OPC UA traffic, or set specific client/server ports.
affects: all
deprecatedaction field 'monitor' is deprecated; use 'subscribe' instead.
fix
Use action='subscribe' with interval and queueSize parameters.
affects: >=0.2.300
Errors
Common errors & fixes
Error: Cannot find module 'node-opcua'
Missing or incomplete installation of node-opcua dependency.
fix
Run 'npm install node-opcua' in the Node-RED user directory or globally.
Error: connect ECONNREFUSED <ip>:4840
OPC UA server is not running or is blocked by firewall.
fix
Check OPC UA server status and ensure port 4840 is open on server and client firewall.
BadNodeIdInvalid: BadNodeIdInvalid
The nodeId string format is incorrect.
fix
Ensure nodeId follows pattern 'ns=<namespaceIndex>;<identifierType>=<identifier>' (e.g., 'ns=2;s=MyVariable').
StatusCode: BadSessionIdInvalid
Session expired or invalid session token.
fix
Reconnect the OpcUa-Client node (e.g., deploy flow again or trigger reconnect).
SecurityError: Certificate verification failed
OPC UA client certificate rejected by server (PKI issue).
fix
Place client's self-signed certificate in server's trusted certificate store, or disable certificate verification (not recommended).
Upgrade
Version history
0.2.351latest on npm
Audit
Dependencies
node-opcuarequiredCore OPC UA protocol implementation
node-redrequiredRequired runtime environment
Agent activity
13 hits · last 30 days
node
10
OpenAI (training)
1
Resources