OPC UA Server
Configure Connectware as an OPC UA server to expose data to OPC UA clients.
Connectware can act as an OPC UA server, exposing data to OPC UA clients. For OPC UA client functionality, see OPC UA Client.
For configuration reference, see:
Configuration
Define a server resource of type Cybus::Server::Opcua in your service commissioning file. OPC UA clients can connect to this server using:
opc.tcp://<connectwareHost>:4841<resourcePath>
Port configuration
Connectware uses port 4841 instead of the standard OPC UA port 4840 to avoid conflicts with other OPC UA servers. Only one OPC UA server instance can run per Connectware installation.
If Connectware is accessible via DNS hostname, specify this hostname in the hostname property to allow connections from outside the Docker network. Do not use localhost as it only refers to the local container.
The resourcePath property defines the connection string prefix and defaults to /UA/CybusOpcuaServer. This path must be included in the connection URL for clients to connect successfully.
Node Structure
Define data points as Cybus::Node::Opcua resources. Nodes form a tree hierarchy:
One root node with its
parentproperty referencing the server.All other nodes reference the root node or intermediate nodes as
parent.
Nodes can be defined in the same service as the server or in separate services using service-id references. This allows adding or removing nodes dynamically by commissioning additional services.
Security Settings
For production environments, only use the SignAndEncrypt security profile. Other profiles allow communication to be intercepted or manipulated. By default, the OPC UA server only permits SignAndEncrypt connections (configured in securityModes).
Authenticate using Connectware username and password credentials via user token.
CA Certificate
When an OPC UA client connects to the server, it verifies that the server certificate was signed by a CA it trusts. The caFile property tells the OPC UA server which CA certificate to use for this.
Connectware ships with its own CA and a matching server certificate. The caFile property defaults to /connectware_certs/cybus_ca.crt, which Connectware places automatically. If you are using the default Connectware certificates, you do not need to configure caFile.
If you are using your own PKI — that is, you have supplied your own certificateFile and privateKeyFile signed by your organization's CA — you must also set caFile to the path of your CA certificate inside the container. Alternatively, you can manually place the CA certificate in /app/.config/node-opcua-default-nodejs.
Service Commissioning File Example
Output Format
If the server receives data from an external OPC UA client, the output on the internal MQTT broker is provided as a JSON object:
Input Format
To provide data to an external OPC UA client, publish the message to the internal MQTT broker in this format:
{hint style="warning"} When using 64-bit integers — which JSON does not support but JavaScript does via BigInt — pass the value as a string containing the decimal number.
OPC UA Method Implementation
OPC UA methods can only be implemented on servers when used in conjunction with FlowSync.
When configured in transaction mode, Cybus::Nodes handle operations differently than standard variable nodes. Any node with the setting operation: transaction follows this workflow:
Publishes request data to the
/treqtopic.Waits to receive a response on the
/trestopic before proceeding.
Example
The following example configuration is taken from FlowSync Example 6.
Request Data Structure
When a method is called, it publishes request details to the /treq topic in the following format:
Each request contains a unique
idfor tracking.The response must include this same
idto complete the flow.
Example
The data structure matches the format shown in FlowSync Example 6.
Response Data Format
Each method call must receive a corresponding response published to the /res topic.
Example
In the FlowSync Example 6, the response will look like this:
Error Response Format
To return an error response from a node, you must include an error property containing the appropriate error code. This code will be used in the method call response. Note that any error.message provided will be ignored.
Example
Last updated
Was this helpful?

