node-red-contrib-opc-rw-pulse 1.0.1

OPC UA nodes for Node-RED: read, write, and pulse a tag TRUE then back to FALSE after a configurable delay, sharing a common connection manager.

npm install node-red-contrib-opc-rw-pulse

node-red-contrib-dcu-opc

Node-RED nodes for talking to an OPC UA server: pulse a tag, subscribe to a tag's changes, or write an arbitrary value.

All three nodes share one connection manager (opc-shared.js), are configured at runtime via a Config message (no redeploy needed to point at a different server/tag), and report connection state on a dedicated status output.

Install

From the project directory:

npm install

Then restart Node-RED, or point your Node-RED ~/.node-red install at this package (npm install /path/to/this/repo) to pick up the three node types.

Nodes

opc-pulse

Writes an OPC UA boolean tag TRUE, then back to FALSE after a configurable delay.

  • msg.topic = "Config" — msg.payload = { server, tag, duration, username?, password?, securityMode?, securityPolicy? }. Saves the settings and opens (or keeps) a connection until the next Config message.
  • msg.topic = "Pulse" — fires the pulse using the currently configured settings. On completion, sends { endpoint, tag, pulsed: true } on output 1.

opc-input

Subscribes to an OPC UA tag and outputs a message every time its value changes.

  • msg.topic = "Config" — msg.payload = { server, tag, username?, password?, securityMode?, securityPolicy? }. Opens (or keeps) a subscription until the next Config message. Changing just the tag re-subscribes on the existing connection; changing the server, credentials, or security settings reconnects.
  • Output 1: on every tag change, { topic: tag, payload: value, endpoint, sourceTimestamp }.
  • If the connection drops, the node automatically retries the subscription every 5 seconds until it succeeds or the node is closed/redeployed.

opc-write

Writes a value to an OPC UA tag on demand.

  • msg.topic = "Config" — msg.payload = { server, tag, dataType?, username?, password?, securityMode?, securityPolicy? }. dataType defaults to "Auto": the node reads the tag's DataType attribute from the server and uses that for the write, falling back to guessing from the JS type of the written value if that read fails. Set it explicitly (Boolean, String, SByte, Byte, Int16, UInt16, Int32, UInt32, Float, Double, DateTime) to override.
  • msg.topic = "Write" — writes msg.payload (coerced to the resolved data type) to the configured tag. On completion, sends { endpoint, tag, value, dataType, written: true } on output 1.

Status output (output 2, all nodes)

Every state change — connecting, connected, connection lost, a failed connect/write/subscribe — is reported on output 2:

{ "topic": "status", "payload": { "state": "connected", "connected": true } }

payload.error is present (the error message) when the state reflects a failure. If a connect attempt fails because the server doesn't offer the requested security mode/policy at that endpoint, the error lists what the server actually offers, e.g.:

End point must exist opc.tcp://host:4840 ... | server offers: opc.tcp://host:4840 [SignAndEncrypt/Basic256Sha256]

Security & credentials

  • securityMode / securityPolicy default to "None"/"None". If the server requires Sign or SignAndEncrypt, node-opcua auto-generates a self-signed client certificate on first use (stored in a local PKI folder) — no setup needed on your end, but the server may need to be told to trust that new certificate on its first connection attempt.
  • Username/password are stored as Node-RED credentials (encrypted at rest), set in the node's edit panel or overridden per Config message. Leave both unset for an anonymous connection.

License

UNLICENSED — internal project use.

Node Info

Version: 1.0.1
Updated 2 weeks, 4 days ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

10 in the last week

Nodes

  • opc-pulse
  • opc-input
  • opc-write

Keywords

  • node-red
  • opc-ua
  • opc
  • pulse

Maintainers