node-red-contrib-opcua

repository·master·Indexed 42 days ago

https://github.com/mikakaraila/node-red-contrib-opcua

A Node-RED node for communicating with or serving as an OPC UA server, based on the node-opcua library. Version 0.2.355 provides OpcUa-Item for defining variables and OpcUa-Client for reading, writing, subscribing, and browsing OPC UA servers.

Tokens
906
Snippets
3
Records
5
Agent score
4%

What's inside node-red-contrib-opcua

  1. Install node-red-contrib-opcua

    master

    To use these nodes in Node-RED, install them via npm. You can install them locally in your Node-RED installation directory or globally.

    # Local installation in Node-RED directory
    npm install node-red-contrib-opcua
    
    # Global installation
    npm install -g node-red-contrib-opcua
  2. Read or write partial arrays in OPC UA

    master

    When working with array types (e.g., datatype=Int32Array), you can read or write specific segments of the array using an index range.

    • To read a partial array: Set msg.payload.range to a string representing the index range (e.g., "2:4").
    • To write to a partial array: Set msg.range to the index range string.
  3. Configure OpcUa-Client input messages

    master

    To control the OpcUa-Client node, pass a message with specific properties. The msg.topic defines the target NodeId and DataType in the format ns=3;s=Counter;datatype=Int32. The msg.action determines the operation to perform.

    ### Input Message Properties
    
    | Property | Function/Value | Notes |
    | :--- | :--- | :--- |
    | payload | set interval for subscription or monitorItem | |
    | interval | Subscription interval | |
    | queueSize | Subscription queue size | |
    | deadbandType | "a" abs. or "p" percent | Action monitor |
    | deadbandValue | integer for deadband | Action monitor |
    | topic | NodeId and DataType in format `ns=3;s=Counter;datatype=Int32` | |
    | action | subscribe | nodeId / variable |
    | | unsubscribe | nodeId / variable |
    | | deletesubscription | subscription |
    | | browse | nodeId / folder |
    | | info | nodeId |
    | | read | nodeId |
    | | write | nodeId & value |
    | | monitor | deadbandtype abs/pro |
    | | events | nodeId |
    | | readmultiple | [nodeId + datatype] |
    | | writemultiple | [nodeId + datatype + value] |
    | | clearitems | empty multiple items (readmultiple / writemultiple) |
  4. Handle OpcUa-Client output messages

    master

    When an OpcUa-Client node completes an operation, it emits a message with the following structure:

    ### Output Message Properties
    
    | Property | Function/Value | Notes |
    | :--- | :--- | :--- |
    | payload | dataValue.value.value | |
    | statusCode | OPC UA StatusCode | |
    | sourceTimestamp | Source timestamp | |
    | serverTimestamp | Server's timestamp | |