OPC UA devices
Use an OPC UA connection to read nodes of another OPC UA server. The gateway connects as an OPC UA client. A mapping inside the connection puts the remote nodes in the address space of the gateway. Use it to give a clear, standard data model to a server that has a complex or poor model.
The key of the device list is opcuaConnections:.
Words on this page
| Word | Meaning |
|---|---|
| remote server | The OPC UA server that the connection reads. |
| source | A node of the remote server. |
| destination | A node of the gateway. |
| security mode | The OPC UA message security: None, Sign or SignAndEncrypt. |
| security policy | The set of algorithms for the secure channel: None, Basic128Rsa15, Basic256, Basic256Sha256, Aes128_Sha256_RsaOaep or Aes256_Sha256_RsaPss. |
How to connect to a remote server
- Add
opcuaConnections:inbrownfieldDevices:. - Add an entry. Set
name:to a short name, andendpointUrl:to the URL of the remote server. - If the remote server needs a user, set
userName:andpassword:. - If the connection must be secure, set
securityMode:andsecurityPolicy:. - Add a
mapping:in the connection. See the next section. - Trust the certificate of the gateway in the remote server. See Certificates.
brownfieldDevices:
opcuaConnections:
# An anonymous connection
- name: LegacyMachine_S1
endpointUrl: opc.tcp://opcuademo.sterfive.com:26541
# A connection with a user name and a password
- name: ProductionLine_S2
endpointUrl: opc.tcp://opcuademo.sterfive.com:26541
userName: admin
password: admin
# A secure connection
- name: SecureSystem_S4
endpointUrl: opc.tcp://opcuademo.sterfive.com:26541
userName: admin
password: admin
securityMode: SignAndEncrypt
securityPolicy: Basic256Sha256
Keys of a connection
| Key | Required | Meaning |
|---|---|---|
name | Required | The name of the connection. |
endpointUrl | Required | The URL of the remote server. |
userName | Optional | The user name for the session. |
password | Optional | The password for the session. |
certificate | Optional | The X509 certificate (PEM) for the session. |
privateKey | Optional | The private key (PEM) of the certificate. |
securityMode | Optional | None, Sign or SignAndEncrypt. The numbers 1, 2 and 3 also work. |
securityPolicy | Optional | None, Basic128Rsa15, Basic256, Basic256Sha256, Aes128_Sha256_RsaOaep or Aes256_Sha256_RsaPss. |
mapping | Optional | The nodes to read from the remote server. |
The key reference lists every key.
How to keep a password out of the file
Write ${NAME} as the value. The gateway reads the environment variable NAME when it starts.
This works for userName, password, certificate and privateKey.
brownfieldDevices:
opcuaConnections:
- name: SecureSystem_S4
endpointUrl: opc.tcp://opcuademo.sterfive.com:26541
userName: ${OPCUA_S4_USERNAME}
password: ${OPCUA_S4_PASSWORD}
securityMode: SignAndEncrypt
securityPolicy: Basic256Sha256
Certificates
- The remote server must trust the certificate of the gateway. Add it to the trust list of the remote server.
- The gateway must trust the certificate of the remote server. A self-signed certificate must be trusted on both sides.
- The gateway keeps its certificates in its
pkifolder.
Folder of pki | Content |
|---|---|
certs | The certificates for the secure channel. |
private | The private keys. |
trusted | The trusted certificates. |
rejected | The rejected certificates. |
warning
Use SignAndEncrypt for a connection over a network that you do not control.
Mapping in a connection
The mapping: of a connection says which remote nodes the gateway reads, and where they go.
| Key | Required | Meaning |
|---|---|---|
source | Required | A node of the remote server: a browse path such as /di:DeviceSet/1:CoffeeMachineA, or a node id. The path starts in the address space of the remote server. It has no connection name. |
destination | Required | A node of the gateway. For binding, it is an existing Variable. For replicat and copy, it is an Object. The gateway creates the new nodes below it. |
type | Optional | binding (default), replicat or copy. |
samplingInterval | Optional | The sampling interval, in ms. It applies to binding only. |
| Type | What the gateway does |
|---|---|
binding | Binds the destination Variable to the source Variable. |
copy | Makes a copy of the source Variable below the destination. |
replicat | Replicates the complete subtree of the source below the destination. |
brownfieldDevices:
opcuaConnections:
- name: S1
endpointUrl: opc.tcp://opcuademo.sterfive.com:26541
userName: ${OPCUA_USERNAME}
password: ${OPCUA_PASSWORD}
securityMode: SignAndEncrypt
securityPolicy: Basic256Sha256
mapping:
- source: /di:DeviceSet/1:CoffeeMachineA/commercialKitchenEquipment:Parameters/commercialKitchenEquipment:BoilerTempWater
destination: /1:ProcessValues/1:BoundVariable
samplingInterval: 1000
type: binding
- source: /di:DeviceSet/1:CoffeeMachineA
destination: /di:DeviceSet
type: replicat
- source: /di:DeviceSet/1:CoffeeMachineA/commercialKitchenEquipment:Parameters/commercialKitchenEquipment:BoilerTempWater
destination: /1:ProcessValues
type: copy