Skip to main content

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​

WordMeaning
remote serverThe OPC UA server that the connection reads.
sourceA node of the remote server.
destinationA node of the gateway.
security modeThe OPC UA message security: None, Sign or SignAndEncrypt.
security policyThe 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​

  1. Add opcuaConnections: in brownfieldDevices:.
  2. Add an entry. Set name: to a short name, and endpointUrl: to the URL of the remote server.
  3. If the remote server needs a user, set userName: and password:.
  4. If the connection must be secure, set securityMode: and securityPolicy:.
  5. Add a mapping: in the connection. See the next section.
  6. 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​

KeyRequiredMeaning
nameRequiredThe name of the connection.
endpointUrlRequiredThe URL of the remote server.
userNameOptionalThe user name for the session.
passwordOptionalThe password for the session.
certificateOptionalThe X509 certificate (PEM) for the session.
privateKeyOptionalThe private key (PEM) of the certificate.
securityModeOptionalNone, Sign or SignAndEncrypt. The numbers 1, 2 and 3 also work.
securityPolicyOptionalNone, Basic128Rsa15, Basic256, Basic256Sha256, Aes128_Sha256_RsaOaep or Aes256_Sha256_RsaPss.
mappingOptionalThe 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 pki folder.
Folder of pkiContent
certsThe certificates for the secure channel.
privateThe private keys.
trustedThe trusted certificates.
rejectedThe 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.

KeyRequiredMeaning
sourceRequiredA 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.
destinationRequiredA 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.
typeOptionalbinding (default), replicat or copy.
samplingIntervalOptionalThe sampling interval, in ms. It applies to binding only.
TypeWhat the gateway does
bindingBinds the destination Variable to the source Variable.
copyMakes a copy of the source Variable below the destination.
replicatReplicates 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