20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored20,919,685Total Points24,106Total Sites23,382Cell Towers69,500Racks Monitored56,753HVAC Units Monitored31,322UPS Units Monitored24,788Generators Monitored

Chapter 3: Data Sources & ProtocolsLesson 15 of 65

Configuring the MQTT Sparkplug Data Source

Set up the MQTT Sparkplug B data source to connect Mango by Radix IoT to an MQTT broker, add edge nodes, and let their BIRTH messages create data points.

  • 12 min read
  • Intermediate
  • Mango 5.x

Overview

MQTT Sparkplug B is an IIoT interoperability specification built on MQTT that provides automatic device discovery through birth/death certificate messages. The Mango by Radix IoT MQTT Sparkplug data source subscribes to a Sparkplug-compliant broker and automatically creates data points when an edge node you have added publishes its BIRTH message.

Prerequisites

  • Mango 5.x with the MQTT Sparkplug module installed
  • An MQTT broker (Mosquitto, HiveMQ, EMQX, etc.)
  • Edge devices publishing Sparkplug B payloads
  • Network access on port 1883 (TCP) or 8883 (SSL/TLS)

Step 1: Create the Data Source

Open Data integration > Data sources, choose New, and set Data source type to MQTT Sparkplug. Save it once the connection fields below are filled in: the Edge Nodes tab only appears on a saved data source.

Step 2: Configure the Broker Connection

Broker URI takes a scheme, host and port, with no path. A new data source starts at tcp://localhost:1883.

Protocol URI Format Usual Port
Plain TCP tcp://broker-hostname:1883 1883
SSL/TLS ssl://broker-hostname:8883 8883

ws:// and wss:// (MQTT over WebSockets) are accepted too. If the broker needs credentials, fill in User name and Password; leave both empty for anonymous access.

Warning

Each Mango instance must use a unique Client Id. The field starts empty and is required, and a data source copied or imported from another instance brings its Client Id with it, so change it. With duplicate IDs the broker drops one client every time the other connects. From 5.7.7 that shows up as connection flapping; on 5.7.4 to 5.7.6 the dropped instance simply goes quiet (see the warning under Connection Tuning).

Connection Tuning

Field Default What it does
Keep Alive interval 60 s Heartbeat for detecting a dead connection
Connection Timeout 30 s How long to wait for the broker to accept the connection
Auto reconnect Off Tick it so the client reconnects by itself after the connection drops. On 5.7.4 to 5.7.6 it never fires: see the warning below
Qos type Exactly Once QoS requested for the subscriptions: Most One (0), Least one (1) or Exactly Once (2). The broker may grant less.

Warning

On Mango 5.7.4 to 5.7.6, a lost broker connection is silent. The data source handles its connection callbacks without the permissions it needs to raise events, so when the connection drops it raises no Connection Failure event, does not mark its points unreliable, and does not reconnect, even with Auto reconnect ticked. A connection that fails at startup is neither reported nor retried. Values simply stop arriving. To recover, disable the data source and enable it again; to notice in time, put a No update event detector on a point that reports often. Fixed in 5.7.7.

Step 3: Set the SCADA Host ID

Primary scada is ticked by default. With it on, Mango acts as the Sparkplug primary host: it publishes an online STATE message under its Scada Host Id, and leaves an offline STATE as its last will so the broker announces it if Mango drops. The field starts empty and is required while Primary scada is ticked; give it something readable and unique, such as mango-primary. Edge nodes that follow the Sparkplug primary-host rule only publish while that host is online, and they have to be configured with the same ID.

Step 4: Configure SSL (Optional)

For ssl:// connections, paste the broker’s CA certificate in PEM format into X509 CA (PEM format). Mango uses it to trust the broker’s certificate.

Step 5: Add Edge Nodes

  1. Save the data source, then open its Edge Nodes tab
  2. Enter the Group ID (e.g., PlantA) and Edge Node ID (e.g., PLC-Line1) exactly as the edge node publishes them; both are case-sensitive
  3. Set the node’s View point & value, Edit point and Set point value permissions (they flow down to its points only with Copy Rebirth Permissions ticked; see Step 6), then click Add. Mango creates one data point for the node, Node Control/Rebirth, and lists the node with a Rebirth button
  4. When the node publishes its BIRTH message, Mango creates a data point for every metric in it. If data arrives from the node before Mango has seen its BIRTH, Mango sends a rebirth request; you can also press Rebirth yourself

Messages from a node you have not added are not turned into points. They raise an Unknown Topic event that names the topic, which is the quickest way to spot a mistyped ID.

Topic Filters

Topic Filters lists the MQTT topics the data source subscribes to, one per line. The default # subscribes to everything on the broker; narrow it (for example spBv1.0/PlantA/#) to cut traffic from groups you do not use.

Step 6: Manage Auto-Generated Points

Each point created from a BIRTH is enabled, named after its metric, and given the node’s or device’s name as its device name. It logs All data, or When point value changes for Boolean metrics. All data stores every value, so review logging before a large rollout.

Tick Copy Rebirth Permissions on the data source if you want each new point to copy its permissions from the node’s Node Control/Rebirth point, so the permissions you gave the node in Step 5 flow down to every point it reports. The box starts unticked on a data source created in the UI.

Tip

Use Data integration > Bulk data point edit to change logging across dozens of auto-discovered points at once.

Troubleshooting

Symptom Likely Cause Resolution
Connection Failure events (5.7.7 and later) Wrong Broker URI, credentials or firewall Verify the URI; test with mosquitto_sub
Values stop arriving, no event (5.7.4 to 5.7.6) The broker connection failed or dropped, which these versions do not report Disable and re-enable the data source; check the URI, credentials and firewall with mosquitto_sub
Connect/disconnect cycling (5.7.7 and later), or one instance going quiet Duplicate Client Id Give every Mango instance its own Client Id
Unknown Topic events, no data points Node not added, or Group ID / Edge Node ID mismatch Add the node; match the IDs exactly (case-sensitive)
Node added but no data points No BIRTH received yet Check the edge node is online; press Rebirth on the Edge Nodes tab
SSL handshake failure Wrong CA certificate Confirm the cert matches the broker’s chain
Points turn unreliable The node sent a DEATH message (it went offline) Check the node; when its data resumes, Mango requests a fresh BIRTH

Get free access to all 65 Mango by Radix IoT training lessons

One short form unlocks every lesson and its video in this browser.

This form is hosted by Zoho. It loads only after you enable support cookies or choose to load it below.

We honored your browser’s Global Privacy Control signal — optional cookies are off and nothing is tracked.