node-red-contrib-connect 0.1.3
Node-RED nodes for AVEVA Connect (Data Hub, OMF, Streams)
node-red-contrib-connect
Node-RED nodes for AVEVA Connect (Data Hub, OMF, Streams).
Features
- OAuth2 Authentication with automatic token refresh
- OMF Write - Send data using OSIsoft Message Format
- Streams Read - Read data from streams with multiple modes
- Events - Subscribe to stream updates with polling
- Full API support for AVEVA Data Hub
Installation
Via Node-RED Palette Manager
- Open Node-RED
- Go to Menu > Manage palette > Install
- Search for
node-red-contrib-connect - Click Install
Via npm
cd ~/.node-red
npm install node-red-contrib-connect
Then restart Node-RED.
Configuration
Setting up AVEVA Connect credentials
- Log in to your AVEVA Connect portal
- Navigate to Developer Tools > Client Credentials
- Create a new client with appropriate permissions:
- For OMF:
ocsapi.data.readwrite - For Streams:
ocsapi.data.readorocsapi.data.readwrite
- For OMF:
- Note the Client ID and Client Secret
Configuration Node Properties
| Property | Description |
|---|---|
| Resource URL | AVEVA Connect base URL (default: https://datahub.connect.aveva.com) |
| Tenant ID | Your AVEVA Connect tenant ID |
| Namespace ID | The namespace to work with |
| Client ID | OAuth2 client ID |
| Client Secret | OAuth2 client secret |
| Token URL | OAuth2 token endpoint |
Nodes
OMF Write
Writes data to AVEVA Connect using the OSIsoft Message Format (OMF).
OMF Message Types:
type- Define data types (schema)container- Define streams (containers)data- Send actual data values
Example - Define Type:
msg.payload = [{
"id": "Temperature",
"type": "object",
"classification": "dynamic",
"properties": {
"Timestamp": { "type": "string", "isindex": true, "format": "date-time" },
"Value": { "type": "number", "format": "float64" }
}
}];
msg.omfMessageType = "type";
Example - Define Container:
msg.payload = [{
"id": "Sensor1",
"typeid": "Temperature"
}];
msg.omfMessageType = "container";
Example - Send Data:
msg.payload = [{
"containerid": "Sensor1",
"values": [{
"Timestamp": new Date().toISOString(),
"Value": 23.5
}]
}];
msg.omfMessageType = "data";
Streams Read
Reads data from AVEVA Connect streams.
Read Modes:
last- Get the most recent valuefirst- Get the oldest valuerange- Get values between start and end timestampswindow- Get the last N valuesinterpolated- Get interpolated values at regular intervals
Example - Read Last Value:
msg.streamId = "Sensor1";
msg.readMode = "last";
Example - Read Range:
msg.streamId = "Sensor1";
msg.readMode = "range";
msg.startIndex = "2024-01-01T00:00:00Z";
msg.endIndex = "2024-01-02T00:00:00Z";
Events
Subscribes to stream updates and emits messages when new data arrives.
Control Commands:
msg.payload = "start"- Start pollingmsg.payload = "stop"- Stop pollingmsg.payload = "status"- Get polling status
Example - Start with Dynamic Streams:
msg.payload = "start";
msg.streamIds = ["Sensor1", "Sensor2", "Sensor3"];
Output Message Format:
{
topic: "Sensor1", // Stream ID
payload: { ... }, // New data from stream
streamId: "Sensor1",
timestamp: "2024-...",
eventType: "data"
}
OMF Overview
OSIsoft Message Format (OMF) is a JSON-based format for sending time-series data. The typical workflow is:
- Define Types - Create a schema for your data
- Define Containers - Create streams that use the types
- Send Data - Send actual values to the containers
For more information, see the OMF Specification.
Compatibility
- Node-RED: >= 2.0.0
- Node.js: >= 14.0.0
- AVEVA Connect: Data Hub API v1
Troubleshooting
Authentication Errors
- Verify your Client ID and Client Secret are correct
- Ensure the client has the necessary permissions
- Check that the Token URL matches your region
Connection Issues
- Verify the Resource URL is correct for your region
- Check network connectivity to AVEVA Connect
- Ensure your tenant and namespace IDs are correct
OMF Errors
- Verify your type definitions are valid JSON
- Ensure container IDs match existing containers
- Check that data values match the defined types
License
MIT
Author
Holger Amort