MQTT OPC-UA, a Coreflux Flux Asset

Hugo Vaz
Coreflux Blog
Published in
4 min readNov 4, 2022

The Purpose of this Flux Asset

Coreflux’s MQTT OPC UA is an asset centered around creating a bridge between a machine’s OPC UA data flow and MQTT, synchronizing data to and from broker and server, to effectively allow OPC-UA compatible devices to communicate with other Coreflux assets.

OPC-UA: Open Platform Communications, Unified Architecture

The Promise

OPC-UA is a cross-platform, open-source, IEC62541 standard for data exchange from sensors to cloud applications developed by the OPC Foundation. In general terms, there are standardized data models available for dozens of industrial equipment types (dubbed “Companion Specifications”), published by the governing foundation. Multiple elements are handled, such as authentication, authorization, encryption, checksums, and multiple communication protocols are foreseen, across platforms.

The Reality

The uniformization of OPC is, when looking at the field, in reality non-existent (despite the initial vision/intention having been sound). Different providers implement it according to their own interpretation of the base specifications. Due to different OPC UA implementations, Coreflux’s support of the OPC protocol will be limited.

This is one of many reasons we consider OPC standard (UA or DA) as a legacy system.

Preparation

In order to properly implement the MQTT OPC UA flux asset, the following conditions must be ensured:

  • Guarantee you have the OPC server installed
  • The certificate of the OPC UA defined in the server

Installation

Once you press “Install”, you will be presented with the asset configuration window:

  • OPC UA server → The server of the OPC UA
  • TCP port of OPC UA → The port for the OPC UA server

After installation, the instance window for this asset installation will display the “Standby” status.

For proper functioning, the asset must be configured (see chapter 5).

To begin execution of the MQTT OPC Bridge Flux Asset, press the Play button, and if successful, the instance status will change to “Running”.

If for some reason the inputted configuration fails to execute (or permission to run is not confirmed by the system), the asset will try to enter a run state but return to a halted state when failing to do so, displaying an error popup (on the GUI Hub) or message (on the command-line Hub). If the asset is running, but you’re not seeing responses, see the section Troubleshooting.

With a version lower than v1.20 in the config file you can change the following attributes:

  • browseOPCServer → True browses all the variables in the OPC UA server
  • autoAcceptServerCertificate → True accept the certificate automatically
  • username → the username for the OPC UA server
  • password → the password for the OPC UA server
  • BaseTopicForBrowse → the topic to browse the variables locally

Configuring the Tags

With a version lower than v1.20 you can find the config in the following file:

<ConnectorTag>
<name>TagExample</name>
<writable>ToOpc</writable>
<mqttTopic>Coreflux/MQTT_OPC_BRIDGE/Vars/Channel1/Device1/TagExample</mqttTopic>
<mqttQos>AtMostOnce</mqttQos>
<mqttRetain>false</mqttRetain>
<opcAdress>s=Channel1.Device1.Tag22</opcAdress>
<opcNsIndex>2</opcNsIndex>
<Type>Boolean</Type>
</ConnectorTag>

The top parameters can be changed via :

  • Name → An identification name for the tag
  • Writable → ToOpc writes down the tag only in the opc direction. ToMqtt writes only to the mqtt direction. ToAll writes down to both directions.
  • mqttTopic → The topic where it will be written
  • mqttQos → AtMostOnce — 0 / AtLeastOnce — 1 / ExactlyOnce — 2
  • mqttRetain → True for retain / false without retain
  • opcAdress → Node id string
  • opcNsIndex → Namespace index for the 2
  • Type → Opc UA type :

Conclusion

Please find us on our discord server for more information.

Join the Coreflux — Flux The System Discord Server!

--

--