Skip to content

OPC UA Connector

The OPC UA (Open Platform Communications Unified Architecture) connector enables communication with OPC UA servers, the industry-standard protocol for industrial automation and data exchange.

Connector Types:

  • OpcuaReader - Read data from OPC UA servers
  • OpcuaWriter - Write data to OPC UA servers
  • ✅ Industry-standard protocol for industrial automation
  • ✅ Multiple authentication methods (Anonymous, Basic, Certificate)
  • ✅ Security modes (None, Sign, SignAndEncrypt)
  • ✅ Configurable polling rates
  • ✅ Support for complex node structures
  • ✅ Both read and write operations
{
"type": "OpcuaReader",
"config": {
"endpoint": "opc.tcp://localhost:4840",
"pollingRate": 1000
},
"variables": [
{
"key": "temperature",
"nodeId": "ns=1;s=Temperature"
},
{
"key": "pressure",
"nodeId": "ns=1;s=Pressure"
}
]
}
{
"type": "OpcuaWriter",
"config": {
"endpoint": "opc.tcp://localhost:4840",
"auth": {
"mode": "Basic",
"username": "opcuser",
"password": "opcpassword"
}
},
"variables": [
{
"key": "setpoint",
"nodeId": "ns=1;s=Setpoint"
},
{
"key": "control_mode",
"nodeId": "ns=1;s=ControlMode"
}
]
}

The OPC UA server endpoint URL.

{
"endpoint": "opc.tcp://192.168.1.100:4840"
}

Format: opc.tcp://[host]:[port][/path]

For readers, the interval in milliseconds between data reads.

{
"pollingRate": 1000 // Read every 1 second
}

Recommended values:

  • Fast: 100-500ms
  • Normal: 1000ms (1 second)
  • Slow: 5000ms (5 seconds)

No authentication required:

{
// No auth field needed
}

Username and password:

{
"auth": {
"mode": "Basic",
"username": "your-username",
"password": "your-password"
}
}

X.509 certificates:

{
"auth": {
"authCertificateFile": {
"mode": "DirectPath",
"fileName": "client-cert.pem",
"path": "/path/to/client-cert.pem"
},
"authKeyFile": {
"mode": "DirectPath",
"fileName": "client-key.pem",
"path": "/path/to/client-key.pem"
}
}
}

Configure security mode and policy:

{
"security": {
"mode": "SignAndEncrypt",
"policy": "Basic256Sha256"
}
}

Security Modes:

  • None - No security (default)
  • Sign - Message signing only
  • SignAndEncrypt - Sign and encrypt messages

Security Policies:

  • None
  • Basic128Rsa15
  • Basic256
  • Basic256Sha256 (recommended)

Variables define which OPC UA nodes to read from or write to.

{
"key": "temperature",
"nodeId": "ns=1;s=Temperature"
}

Fields:

  • key - The key name in the Meddle payload
  • nodeId - The OPC UA node identifier

OPC UA supports several node ID formats:

{
"key": "sensor1",
"nodeId": "ns=1;s=SensorName"
}

Format: ns=[namespace];[type]=[identifier]

Where:

  • ns - Namespace index (0-65535)
  • type - Node ID type:
    • s - String
    • i - Numeric
    • g - GUID
    • b - Opaque (Base64)
OPC UA Server → OpcuaReader → Meddle Payload

Example:

OPC UA nodes:

  • ns=1;s=Temperature = 25.5
  • ns=1;s=Pressure = 101.3

Output payload:

{
"temperature": 25.5,
"pressure": 101.3
}
Meddle Payload → OpcuaWriter → OPC UA Server

Example:

Input payload:

{
"setpoint": 30.0,
"mode": "auto"
}

Writes to:

  • ns=1;s=Setpoint ← 30.0
  • ns=1;s=Mode ← “auto”

Read temperature sensors from a PLC:

{
"type": "OpcuaReader",
"config": {
"endpoint": "opc.tcp://plc.local:4840",
"pollingRate": 1000
},
"variables": [
{
"key": "zone1_temp",
"nodeId": "ns=2;s=Zone1.Temperature"
},
{
"key": "zone2_temp",
"nodeId": "ns=2;s=Zone2.Temperature"
},
{
"key": "ambient_temp",
"nodeId": "ns=2;s=Ambient.Temperature"
}
]
}

Write setpoints to control a process:

{
"type": "OpcuaWriter",
"config": {
"endpoint": "opc.tcp://plc.local:4840",
"auth": {
"mode": "Basic",
"username": "operator",
"password": "secure123"
}
},
"variables": [
{
"key": "temperature_setpoint",
"nodeId": "ns=2;s=Control.TempSetpoint"
},
{
"key": "pressure_setpoint",
"nodeId": "ns=2;s=Control.PressureSetpoint"
}
]
}

Monitor multiple machines:

{
"type": "OpcuaReader",
"config": {
"endpoint": "opc.tcp://scada.local:4840",
"pollingRate": 500
},
"variables": [
{
"key": "machine1_status",
"nodeId": "ns=3;s=Machine1.Status"
},
{
"key": "machine1_speed",
"nodeId": "ns=3;s=Machine1.Speed"
},
{
"key": "machine1_count",
"nodeId": "ns=3;s=Machine1.ProductCount"
},
{
"key": "machine2_status",
"nodeId": "ns=3;s=Machine2.Status"
},
{
"key": "machine2_speed",
"nodeId": "ns=3;s=Machine2.Speed"
}
]
}

Problem: Cannot connect to OPC UA server

Solutions:

  1. Verify the endpoint URL is correct
  2. Check network connectivity: ping [server-ip]
  3. Verify the port is open: telnet [server-ip] 4840
  4. Check firewall rules
  5. Ensure the OPC UA server is running

Problem: Authentication errors

Solutions:

  1. Verify username and password are correct
  2. Check if the user has appropriate permissions
  3. For certificate auth, ensure certificates are valid and not expired
  4. Verify certificate paths are correct

Problem: “Node not found” errors

Solutions:

  1. Use an OPC UA client (like UaExpert) to browse the server
  2. Verify the namespace index is correct
  3. Check the node ID format matches the server’s format
  4. Ensure the node exists and is accessible

Problem: Security policy errors

Solutions:

  1. Check which security policies the server supports
  2. Match the security.policy to a supported policy
  3. Ensure certificates are properly configured for encrypted connections

Problem: Slow data updates or high CPU usage

Solutions:

  1. Increase pollingRate to reduce frequency
  2. Reduce the number of variables being read
  3. Use subscription-based reading if supported
  4. Check network latency

Don’t poll faster than necessary:

  • Critical data: 100-500ms
  • Normal monitoring: 1000ms
  • Slow-changing values: 5000ms+

Always use authentication and encryption in production:

{
"auth": {
"mode": "Basic",
"username": "user",
"password": "pass"
},
"security": {
"mode": "SignAndEncrypt",
"policy": "Basic256Sha256"
}
}

Keep related variables in the same connector for better organization:

{
"variables": [
// Temperature sensors
{"key": "temp1", "nodeId": "ns=1;s=Temp1"},
{"key": "temp2", "nodeId": "ns=1;s=Temp2"},
// Pressure sensors
{"key": "press1", "nodeId": "ns=1;s=Press1"},
{"key": "press2", "nodeId": "ns=1;s=Press2"}
]
}

Meddle automatically handles connection loss and reconnection, but consider:

  • Using a Merge connector with timeout to handle missing data
  • Adding Alert connectors to notify on connection issues

Start with anonymous authentication to verify connectivity, then add security:

  1. Test with no auth
  2. Add username/password
  3. Add encryption
  4. Add certificate authentication
OpcuaReader → Filter → Reshape → InfluxDb2Writer
Trigger → Alert (email on high temp)
  1. OpcuaReader: Read temperature and pressure
  2. Filter: Keep only relevant fields
  3. Reshape: Add metadata (location, unit)
  4. InfluxDb2Writer: Store in time-series database
  5. Trigger: Check for high temperature
  6. Alert: Send email if threshold exceeded
  • Modbus - Alternative industrial protocol
  • Siemens S7 - Direct Siemens PLC communication
  • Filter - Filter OPC UA data
  • Trigger - Conditional logic on OPC UA data