Node-RED nodes for AVEVA Connect (Data Hub, OMF, Streams)
npm install node-red-contrib-connectnode-red-contrib-connect
bash
cd ~/.node-red
npm install node-red-contrib-connect
`
Then restart Node-RED.
Configuration
$3
1. Log in to your AVEVA Connect portal
2. Navigate to Developer Tools > Client Credentials
3. Create a new client with appropriate permissions:
- For OMF: ocsapi.data.readwrite
- For Streams: ocsapi.data.read or ocsapi.data.readwrite
4. Note the Client ID and Client Secret
$3
| 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
$3
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:
`javascript
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:
`javascript
msg.payload = [{
"id": "Sensor1",
"typeid": "Temperature"
}];
msg.omfMessageType = "container";
`
Example - Send Data:
`javascript
msg.payload = [{
"containerid": "Sensor1",
"values": [{
"Timestamp": new Date().toISOString(),
"Value": 23.5
}]
}];
msg.omfMessageType = "data";
`
$3
Reads data from AVEVA Connect streams.
Read Modes:
- last - Get the most recent value
- first - Get the oldest value
- range - Get values between start and end timestamps
- window - Get the last N values
- interpolated - Get interpolated values at regular intervals
Example - Read Last Value:
`javascript
msg.streamId = "Sensor1";
msg.readMode = "last";
`
Example - Read Range:
`javascript
msg.streamId = "Sensor1";
msg.readMode = "range";
msg.startIndex = "2024-01-01T00:00:00Z";
msg.endIndex = "2024-01-02T00:00:00Z";
`
$3
Subscribes to stream updates and emits messages when new data arrives.
Control Commands:
- msg.payload = "start" - Start polling
- msg.payload = "stop" - Stop polling
- msg.payload = "status" - Get polling status
Example - Start with Dynamic Streams:
`javascript
msg.payload = "start";
msg.streamIds = ["Sensor1", "Sensor2", "Sensor3"];
`
Output Message Format:
`javascript
{
topic: "Sensor1", // Stream ID
payload: { ... }, // New data from stream
streamId: "Sensor1",
timestamp: "2024-...",
eventType: "data"
}
``