Abstract
This page describes how MQTT Transmission Transmitter configurations interact with Ignition tag trees to publish MQTT messages and tags to an MQTT Server. It explains how tags get identified to be published as well as the specific topics that data will be published on. It also goes over some example configurations to show how the system will behave in different scenarios.
Sparkplug Overview
All MQTT clients using the Sparkplug specification will publish MQTT messages consisting of a topic and payload component. For the Sparkplug B specification, which is used by MQTT Transmission, the Topic Namespace structure is defined as
spBv1.0/GROUP_ID/VERB/EDGE_NODE_ID/DEVICE_ID
where
- GROUP_ID is meant to represent a logical grouping of Edge Nodes. This can be a region, a facility name, or any meaningful grouping of Edge Nodes within your application.
- VERB provides an indication on how to handle the payload of the message. This includes whether the message is a birth certificate, death certificate, data message, command message, etc.
- EDGE_NODE_ID is the ID of the logical Edge Node. This is often the name of the system running Ignition with MQTT Transmission.
- DEVICE_ID is the ID of a device attached to the Ignition instance. This can be a PLC or logical grouping of tags that represent a physical or logical device connected to Ignition.
In the Sparkplug specification there are two Sparkplug Descriptors defined as:
- Edge Node Descriptor which is the GROUP_ID and EDGE_NODE_ID combination
- Device Descriptor which is the GROUP_ID, EDGE_NODE_ID and DEVICE_ID combination
The MQTT topics are essentially the 'addresses' of the different components in the distributed system and the Sparkplug Edge Node Descriptor must be unique within the distributed system. Because these are used as 'addresses' in the system you should never have two that conflict with each other - it is a bit like having two houses with the same postal address. It isn't possible for other MQTT clients in the system to tell which edge node sent the data and, when sending messages to them, they will both receive the messages.
Of course, you can have two or more Edge Nodes with the same GROUP_ID as long as each EDGE_NODE_ID is unique. To use the analogy above, it would be like having houses on the same street with different house numbers.
Transmitters and Tag Trees
MQTT Transmission is designed to dynamically pick up tags in Ignition or Ignition Edge and publish tag change events to an MQTT Server. How the tags are published to the MQTT Server is based on a combination of a 'Transmitter' configuration as well as the arrangement of tags in the Ignition tag tree.
A transmitter will use the tag folder hierarchy under the configured Tag Path in combination with the Sparkplug IDs to dynamically build the topic namespace used to represent the tags.
The following the rules below are used when building the topic namespace:
If the Sparkplug IDs are empty, there must be at least 3 folder levels below the Tag Path to resolve the Group, Edge and Device IDs (if needed) where the Group and Edge combination is unique.
If the Sparkplug Group ID only is configured, there must be at least 2 folder levels below the Tag Path to resolve to Edge and Device IDs (if needed) where the Group and Edge combination is unique.
If the Sparkplug Group ID and Edge ID only are configured, there must be least 1 folder level or device level UDT below the Tag Path to resolve to a Device ID (if needed)
If the Sparkplug IDs are all configured the tag folder hierarchy will not be used
MQTT Transmission will then use the remainder of the tag folder hierarchy not used in the topic namespace to identify the name of the tag included in the payload metrics.
Let’s take a look at some examples that demonstrate how the message topic and payload are affected by the tag tree and Transmitter configurations starting with a basic Ignition tag folder hierarchy conforming to the GroupID, EdgeNodeID and DeviceID structure and the default Transmitter configuration.