Skip to main content
Version: 2.0-dev

OPC DA Integration Guide

Connect MaestroHub to OPC DA servers through a Windows agent for tag browsing, reading, writing, and real-time subscriptions. The agent runs on a Windows machine with access to OPC DA servers and exposes a WebSocket interface for MaestroHub communication.

Overview

The OPC DA connector provides:

  • WebSocket-based communication with a Windows agent that bridges to OPC DA servers via COM/DCOM
  • Server discovery to list available OPC DA servers on the agent machine
  • Interactive tag browsing to explore the OPC DA address space hierarchy
  • Read/write operations with OPC quality codes and timestamps
  • Real-time subscriptions with configurable update rates and deadband filtering
  • Server health monitoring via on-demand status queries
Prerequisites

The MaestroHub OPC DA Windows Agent must be installed and running on a Windows machine that has access to the target OPC DA server(s). The agent provides the WebSocket endpoint and handles all COM/DCOM communication with OPC DA servers.

Connection Configuration

Creating an OPC DA Connection

Navigate to Connections -> New Connection -> OPC DA and configure the following fields.

1. Profile Information

FieldTypeRequiredDefaultDescription
Connection NameTextYes-A unique, descriptive name for this connection (1-100 characters)
DescriptionTextNo-Optional description for this OPC DA connection

2. Agent Configuration

FieldTypeRequiredDefaultValidationDescription
HostTextYeslocalhostNon-empty stringHostname or IP address of the Windows machine running the OPC DA agent
PortNumberNo452811 - 65535WebSocket port of the OPC DA agent
ProgIDTextYes-Non-empty stringOPC DA server ProgID to connect to (e.g. Matrikon.OPC.Simulation.1)

Agent URL Format

The full WebSocket URL is automatically constructed: ws://{host}:{port} Example: ws://192.168.1.100:45281

3. Authentication

FieldTypeRequiredDefaultDescription
API TokenPasswordYes-API token for authenticating with the Windows agent (stored securely, encrypted at rest)

4. Connection Behavior

FieldTypeRequiredDefaultDescription
Auto ConnectBooleanNotrueAutomatically connect to the OPC server (using the configured ProgID) when the connection starts

5. Timeout Configuration

FieldTypeRequiredDefaultValidationDescription
Connect Timeout (seconds)NumberNo305 - 120Maximum time to wait when establishing the WebSocket connection to the agent
Reconnect Interval (seconds)NumberNo51 - 60Time to wait before attempting to reconnect after connection loss
Ping Interval (seconds)NumberNo3010 - 300Interval for sending keep-alive pings to the agent
Request Timeout (seconds)NumberNo301 - 120Maximum time to wait for individual operation responses (browse, read, write, etc.)

6. Limits

FieldTypeRequiredDefaultValidationDescription
Browse LimitNumberNo5000100 - 50,000Maximum number of nodes returned per browse operation
Max SubscriptionsNumberNo100001 - 50,000Maximum number of subscribed tags across all subscription functions
Max Subscription GroupsNumberNo1001 - 500Maximum number of subscription groups (each subscribe function creates one group)

7. Subscription Defaults

FieldTypeRequiredDefaultValidationDescription
Default Update Rate (ms)NumberNo1000100 - 60,000Default update rate in milliseconds for subscriptions. The OPC server may negotiate a different actual rate.
Default Deadband (%)NumberNo0.00.0 - 100.0Default deadband percentage for subscriptions. Only value changes exceeding this percentage are reported.

8. Connection Labels

FieldTypeRequiredDefaultDescription
LabelsKey-Value PairsNo-Key-value pairs to categorize and organize this connection (max 10 labels)
Notes
  • Windows Agent Required: The MaestroHub OPC DA agent must be installed and running on a Windows machine before creating this connection.
  • Default Port: The standard agent port is 45281.
  • ProgID: This is the COM identifier for the OPC DA server. Use the Discover function to list available servers and their ProgIDs on the agent machine.
  • Auto Connect: When enabled, the agent automatically connects to the OPC DA server (identified by ProgID) as soon as the WebSocket connection is established. When disabled, the WebSocket connects but OPC operations will fail until a server connection is established.
  • Deadband: A deadband of 0.0 means every value change is reported. A deadband of 5.0 means only changes greater than 5% of the value range are reported, reducing network traffic for noisy analog signals.
  • Secret Fields: apiToken is encrypted at rest and masked in API responses.

Function Builder

Available Function Types

Once the connection is saved, the following function types are available:

Function Type IDNameTestableCategoryDescription
opcda.discoverDiscover OPC ServersYesDiscoveryLists available OPC DA servers on the agent machine
opcda.browseBrowse Tag HierarchyYesDiscoveryBrowses the OPC DA address space
opcda.readRead Tag ValuesYesReadReads current values from OPC DA tags
opcda.writeWrite Tag ValuesYesWriteWrites values to OPC DA tags
opcda.subscribeSubscribe to Tag ChangesNoSubscriptionSubscribes to real-time tag value changes
opcda.statusGet Server StatusYesMonitoringGets OPC server health and status information

Browse Tag Hierarchy

Function Type ID: opcda.browse Testable: Yes

Browses the OPC DA address space to discover available tags. Navigate through the hierarchy from root to leaf nodes. Requires an active OPC server connection.

Configuration Fields

FieldTypeRequiredDefaultDescription
PathTextNo"" (empty)Item ID to browse. Leave empty to browse from root. Example: Simulation.Random
LimitNumberNoConnection's browseLimitMaximum number of nodes to return. Capped at the connection's configured browse limit.

Response Structure

FieldTypeDescription
pathStringThe browsed path
nodesArrayList of child nodes
nodes[].nameStringNode display name
nodes[].itemIdStringFull OPC Item ID (used for read/write/subscribe operations)
nodes[].typeStringNode type: leaf (readable tag) or branch (folder/container)
nodes[].accessRightsStringAccess permissions: read, write, or readWrite
nodes[].hasChildrenBooleanWhether the node has child nodes
truncatedBooleantrue if results were truncated due to the limit

Read Tag Values

Function Type ID: opcda.read Testable: Yes

Reads current values from one or more OPC DA tags. Each tag value includes OPC quality information and a timestamp. Requires an active OPC server connection.

Configuration Fields

FieldTypeRequiredDefaultDescription
TagsArray of StringsYes-Array of tag Item IDs to read (minimum 1 tag). Example: ["Simulation.Random.Int1", "Simulation.Random.Real4"]
From DeviceBooleanNofalseWhen true, reads directly from the device. When false, reads from the OPC server's cache (faster).

Response Structure

FieldTypeDescription
valuesArrayList of tag values
values[].pathStringTag Item ID
values[].valueAnyCurrent tag value (type depends on the tag's data type)
values[].qualityStringOPC quality code string
values[].timestampStringISO 8601 timestamp of last value change

OPC Quality Codes

QualityDescription
GoodValue is valid and reliable
BadValue is invalid or unreliable
Bad_CommFailureCommunication failure with the device
Bad_DeviceFailureDevice has failed
Bad_SensorFailureSensor has failed
Bad_OutOfServiceTag is out of service
Bad_ConfigurationErrorTag configuration error
UncertainValue may be questionable
Uncertain_LastUsableValueLast known good value, device currently unreachable
Uncertain_SensorNotAccurateSensor reading may be inaccurate
tip

Individual tag errors are reflected in the quality field rather than failing the entire request. Always check the quality field for each value to ensure data reliability.


Write Tag Values

Function Type ID: opcda.write Testable: Yes

Writes values to one or more OPC DA tags. Supports partial success -- individual tag write failures are reported per-item without failing the entire operation. Requires an active OPC server connection.

Configuration Fields

FieldTypeRequiredDescription
DataArray of ObjectsYesArray of write items (minimum 1 item)
Data[].pathTextYesTag Item ID to write to. Example: Simulation.Random.Int1
Data[].valueAnyYesValue to write. Type should match the tag's data type.

Response Structure

FieldTypeDescription
resultsArrayPer-item write results
results[].pathStringTag Item ID
results[].successBooleanWhether the write succeeded
results[].errorStringError message if the write failed (empty on success)
successCountNumberNumber of successful writes
failureCountNumberNumber of failed writes
tip

Check accessRights from the Browse function to confirm a tag is writable before attempting writes. Tags with read access rights will fail on write.


Subscribe to Tag Changes

Function Type ID: opcda.subscribe Testable: No (event-driven)

Subscribes to real-time value changes for one or more tags. When subscribed tag values change, events are automatically pushed to connected pipelines. Each subscription function creates one OPC DA subscription group. Requires an active OPC server connection.

Configuration Fields

FieldTypeRequiredDefaultValidationDescription
TagsArray of StringsYes-Non-empty arrayArray of tag Item IDs to subscribe to. Example: ["Simulation.Random.Int1"]
Update Rate (ms)NumberNoConnection's defaultUpdateRateMs100 - 60,000Requested update rate in milliseconds. The OPC server may negotiate a different actual rate.
Deadband (%)NumberNoConnection's defaultDeadbandPercent0.0 - 100.0Deadband percentage. Only value changes exceeding this percentage are reported.

Event Payload Structure (DATA_CHANGE)

When tag values change, events are pushed with the following structure:

FieldTypeDescription
payloadArrayArray of changed tag values
payload[].pathStringTag Item ID
payload[].valueAnyNew tag value
payload[].qualityStringOPC quality code string
payload[].timestampStringISO 8601 timestamp

Event Metadata

KeyDescription
protocolAlways opcda
groupOPC DA subscription group identifier
tagCountNumber of changed tags in this event
eventTypeAlways DATA_CHANGE
Important Notes
  • Subscribe functions are event-driven and cannot be tested directly.
  • Events fire automatically when any subscribed tag value changes.
  • The connection must be active for subscriptions to work.
  • Subscriptions are automatically restored after connection loss and reconnection.
  • Each subscription function creates one OPC DA subscription group on the server.

Error Codes

The OPC DA connector classifies errors into specific categories for easier troubleshooting:

Error CodeDescriptionTroubleshooting
OPCDA_AUTH_ERRORAuthentication failedVerify the API token is correct and the agent accepts it
OPCDA_NOT_CONNECTEDNot connected to OPC serverCheck that the ProgID is correct and the OPC server is running
OPCDA_SERVER_ERROROPC server not foundVerify the ProgID, use the Discover function to list available servers
OPCDA_TAG_ERRORTag not foundVerify the tag Item ID, use the Browse function to discover valid tags
OPCDA_WRITE_ERRORWrite operation failedCheck tag access rights and value data type compatibility
OPCDA_LIMIT_ERRORSubscription or group limit reachedReduce subscriptions or increase limits in connection configuration
OPCDA_TIMEOUT_ERROROperation timed outIncrease request timeout or check network connectivity
OPCDA_COM_ERRORCOM/DCOM error on the agentCheck Windows DCOM configuration and OPC server health
OPCDA_CONNECTION_ERRORCannot reach the agentVerify agent host/port and network connectivity
OPCDA_ERRORGeneral errorCheck the error message for details

Scaling

The OPC DA connector operates in Exclusive mode with a single replica. This is because:

  • The WebSocket connection maintains stateful sessions
  • The OPC DA server connection is tied to a specific WebSocket session
  • Subscription state must remain consistent within a single connection

This is managed automatically by MaestroHub and requires no user configuration.