{"id":18610,"library":"node-red-contrib-opcua","title":"node-red-contrib-opcua","description":"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.","status":"active","version":"0.2.351","language":"javascript","source_language":"en","source_url":"https://github.com/mikakaraila/node-red-contrib-opcua","tags":["javascript","node-red","OPC UA","opc-ua","unified automation","opc foundation","node-opcua"],"install":[{"cmd":"npm install node-red-contrib-opcua","lang":"bash","label":"npm"},{"cmd":"yarn add node-red-contrib-opcua","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-red-contrib-opcua","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core OPC UA protocol implementation","package":"node-opcua","optional":false},{"reason":"Required runtime environment","package":"node-red","optional":false}],"imports":[{"note":"This is a Node-RED node, not a library. Import is done automatically by Node-RED after npm install.","wrong":"const OpcUaClient = require('node-red-contrib-opcua')","symbol":"OpcUa-Client","correct":"import the node via Node-RED palette after installation"},{"note":"Nodes are registered with Node-RED and appear in the palette. No manual import needed.","wrong":"import { OpcUaItem } from 'node-red-contrib-opcua'","symbol":"OpcUa-Item","correct":"import the node via Node-RED palette after installation"},{"note":"Only install the package; Node-RED handles node registration.","wrong":"const server = require('node-red-contrib-opcua').OpcUaServer","symbol":"OpcUa-Server","correct":"import the node via Node-RED palette after installation"}],"quickstart":{"code":"// No code snippets needed - this is a Node-RED node collection.\n// To use: Install Node-RED, then run:\n// npm install node-red-contrib-opcua\n// Then in Node-RED flows, drag OpcUa-Client, OpcUa-Item, OpcUa-Server nodes.\n// Example flow (JSON) to read a variable:\n// [{\"id\":\"n1\",\"type\":\"OpcUa-Item\",\"name\":\"example-item\",\"topic\":\"ns=2;s=MyVariable\",\"datatype\":\"Int32\"},\n//  {\"id\":\"n2\",\"type\":\"OpcUa-Client\",\"name\":\"example-client\",\"endpoint\":\"opc.tcp://localhost:4840\",\"action\":\"read\",\"items\":[\"n1\"]},\n//  {\"id\":\"n3\",\"type\":\"inject\",\"name\":\"trigger\",\"topic\":\"\",\"payload\":\"\",\"repeat\":\"\",\"crontab\":\"\",once\":false},\n//  {\"id\":\"n4\",\"type\":\"debug\",\"name\":\"output\"},\n//  {\"id\":\"n3\",\"wires\":[[\"n2\"]]}, {\"id\":\"n2\",\"wires\":[[\"n4\"]]}]","lang":"javascript","description":"Installation and minimal flow to read an OPC UA variable using OpcUa-Client and OpcUa-Item nodes."},"warnings":[{"fix":"Update to v0.2.223+ and ensure variable nodes have correct namespace index.","message":"From v0.2.223, namespace index used with variables for set value; flows using older version may need adjustment.","severity":"breaking","affected_versions":"<0.2.223"},{"fix":"Update to latest node-opcua and this package, check node-opcua migration guides.","message":"The node-opcua library has undergone major API changes; some deprecated methods may cause warnings.","severity":"deprecated","affected_versions":">=0.2.300"},{"fix":"Format topic as 'ns=<namespace>;s=<identifier>;datatype=<DataType>' (e.g., 'ns=3;s=Counter;datatype=Int32').","message":"Payload must include both nodeId and datatype in topic field for read/write operations.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Node.js to version 15 or later.","message":"Node.js 15 minimum required (engines field). Older Node.js versions may cause installation failures.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Configure firewall to allow OPC UA traffic, or set specific client/server ports.","message":"Firewall blocks: OPC UA uses dynamic ports for discovery; ensure network allows OPC UA TCP (port 4840 by default) and discovery endpoints.","severity":"gotcha","affected_versions":"all"},{"fix":"Use action='subscribe' with interval and queueSize parameters.","message":"action field 'monitor' is deprecated; use 'subscribe' instead.","severity":"deprecated","affected_versions":">=0.2.300"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install node-opcua' in the Node-RED user directory or globally.","cause":"Missing or incomplete installation of node-opcua dependency.","error":"Error: Cannot find module 'node-opcua'"},{"fix":"Check OPC UA server status and ensure port 4840 is open on server and client firewall.","cause":"OPC UA server is not running or is blocked by firewall.","error":"Error: connect ECONNREFUSED <ip>:4840"},{"fix":"Ensure nodeId follows pattern 'ns=<namespaceIndex>;<identifierType>=<identifier>' (e.g., 'ns=2;s=MyVariable').","cause":"The nodeId string format is incorrect.","error":"BadNodeIdInvalid: BadNodeIdInvalid"},{"fix":"Reconnect the OpcUa-Client node (e.g., deploy flow again or trigger reconnect).","cause":"Session expired or invalid session token.","error":"StatusCode: BadSessionIdInvalid"},{"fix":"Place client's self-signed certificate in server's trusted certificate store, or disable certificate verification (not recommended).","cause":"OPC UA client certificate rejected by server (PKI issue).","error":"SecurityError: Certificate verification failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}