Crosser + UNS - Publish OPC data to UNS
Connecting industrial equipment to the UNS requires publishing data using the correct data model and a well-defined MQTT topic structure. The example below demonstrates a straightforward approach to achieving this using OPC UA.
1. Connect to OPC UA Server
You can specify the NodeIds to subscribe to in one of three ways: manually through the module UI, by providing a resource file, or by sending a NodeId list from the OPC UA Browser.
For the first two approaches, you don’t need the MQTT Sub Client and OPC UA Browser module since you specify the tags directly.
The third approach allows you to trigger the browsing from external systems and also to send in the root NodeId from which to start the browsing. This will update all subscriptions on the OPC UA Subscriber module.
An end-to-end flow including the browsing capability could look like this.
2. Map data to your envisioned data model
The Message Template module can be used to map data from the incoming message using template syntax.
3. Create MQTT topic based on ‘path’ in OPC UA
To create the MQTT topic you can use the Property Mapper, add a new property called ‘topic’ which is a concatenated string with a site-name ‘stockholm’ and the path from OPC UA.
4. Publish data to UNS
The MQTT Publisher will now publish the messages in the defined data model to the dynamic MQTT topic.
Note: When working with protocols like Modbus, S7, or others that lack a clear data structure, you can include the relevant topic information and other metadata directly in the resource file. Learn more about this.