Sparkplug B solves real problems on the plant floor: a fixed topic structure, birth and death certificates, typed metrics. Then someone outside OT asks a simple question, "can I get the filler temperature into our dashboard / data lake / Python notebook?", and you find out the payload is a binary Protocol Buffer that nothing outside the SCADA world can read.

The usual answers are all some form of "write and run a decoder":

  • a Node-RED flow with a Sparkplug decode node,
  • a Python or Java service using the Eclipse Tahu libraries,
  • a rule in the broker's rule engine that you now have to maintain,
  • or an extra Sparkplug-aware historian.

This post shows a different approach: let the broker publish a JSON copy of every Sparkplug B message on an ISA-95 topic, so Sparkplug nodes, plain MQTT devices and PLC gateways end up in one readable Unified Namespace (UNS). The examples use ConnectMQ, a managed MQTT broker that does this conversion automatically, but the topic design and UNS principles apply to any broker.

One broker, one namespace: devices, Edge and Sparkplug B nodes publish to ConnectMQ, ISA-95 paths become a device tree

Sparkplug B in 60 seconds

Sparkplug B topics have a fixed shape:

spBv1.0/<group_id>/<message_type>/<edge_node_id>/<device_id> 
Message type Meaning
NBIRTH / DBIRTH Node or device comes online and announces its metrics
NDATA / DDATA New metric values
NDEATH / DDEATH Node or device goes offline (usually the Last Will)
NCMD / DCMD Command to a node or device
STATE Online state of a host application such as SCADA

The payload is protobuf: a list of named, typed metrics. Compact and well specified, but opaque to mosquitto_sub, a web dashboard or a pandas notebook.

What a Unified Namespace needs

A UNS is one topic tree where every system publishes its current data and finds everyone else's. Four principles:

  1. One structure, usually the ISA-95 equipment hierarchy: enterprise/site/area/line/device/kind.
  2. Report by exception: publish when a value changes.
  3. Current state lives in the broker (retained messages).
  4. Edge-driven: devices and gateways connect out; nothing polls them.

Sparkplug B already gives you 2, 3 (via births) and 4. What it does not give you is principle 1 in a form that non-Sparkplug consumers can read. That is the gap the conversion fills.

How the automatic conversion maps topics

The Sparkplug group ID is split into ISA-95 site and area at the first _ or -; the edge node becomes the line, the device stays the device, and the message type becomes the last level:

spBv1.0/<site>_<area>/<type>/<edge_node>/<device> → connectmq/<site>/<area>/<edge_node>/<device>/<suffix> 
Sparkplug B ISA-95 topic
Group plant1_packing site plant1, area packing
Edge node line1 line line1
Device filler1 device filler1 (edge node name if no device)
DDATA, NDATA …/telemetry
DBIRTH, NBIRTH …/birth
DDEATH, NDEATH …/death
DCMD, NCMD …/command
STATE …/state

A real pair, original and converted:

spBv1.0/plant1_packing/DDATA/line1/filler1 protobuf (delivered unchanged) connectmq/plant1/packing/line1/filler1/telemetry JSON copy 

And the payload becomes one flat object keyed by metric name:

{ "Temperature": 71.4, "Speed": 120, "Running": true, "timestamp": 1763049600000 } 

The original Sparkplug message is still delivered unchanged, so your SCADA and Sparkplug host applications keep working. The JSON copy keeps the QoS and retained flag of the original and carries two MQTT 5 user properties: x-converted-from: sparkplug-b and x-original-topic.

Tip: name your Sparkplug groups site_area (for example plant1_packing, izmir-welding) so the ISA-95 levels come out right.

Consuming the namespace from Python

No protobuf, no Tahu, just JSON and a wildcard:

import json, paho.mqtt.client as mqtt def on_connect(c, userdata, flags, rc, props): c.subscribe("connectmq/+/+/+/+/telemetry") # every converted Sparkplug device c.subscribe("acme/+/+/+/+/telemetry") # plus your plain MQTT devices def on_message(c, userdata, msg): data = json.loads(msg.payload) origin = dict(getattr(msg.properties, "UserProperty", [])) # MQTT 5 user properties print(msg.topic, data, origin.get("x-original-topic", "")) c = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="connectmq_client_123456_uns-reader", protocol=mqtt.MQTTv5) c.username_pw_set("YOUR_USERNAME", "YOUR_PASSWORD") c.tls_set() c.on_connect, c.on_message = on_connect, on_message c.connect("broker.connectmq.com", 8883) c.loop_forever() 

Output:

connectmq/plant1/packing/line1/filler1/telemetry {'Temperature': 71.4, 'Speed': 120, 'Running': True, 'timestamp': 1763049600000} spBv1.0/plant1_packing/DDATA/line1/filler1 acme/istanbul/assembly/line1/cnc-01/telemetry {'temperature': 62.4, 'spindleRpm': 11950} 

Want offline alerts? Subscribe to connectmq/+/+/+/+/death. Every NDEATH/DDEATH lands there as JSON.

Ignition: three settings that matter

Ignition's MQTT Transmission module connects to the broker like any MQTT client. Three things to check:

  1. Turn metric aliases off. Sparkplug lets nodes announce aliases in the BIRTH and then send only numbers in DATA messages. The JSON conversion needs metric names in every message; alias-only metrics are left out of the JSON copy.
  2. Group ID as site_area. See the tip above.
  3. One unique client ID per transmitter. Two transmitters with the same ID disconnect each other (0x8E).

Datasets, templates and byte arrays are skipped by the conversion, and per-metric timestamps are not copied (the payload timestamp is). If you need those, consume the original spBv1.0/... topic for that metric.

The rest of the plant: PLCs without Sparkplug

Most plants are not 100% Sparkplug. Siemens S7 PLCs, Modbus energy meters and IEC 61850 relays still need a gateway. ConnectMQ Edge is a Windows gateway that reads S7, Modbus TCP/RTU, OMRON, OPC UA, IEC 60870-5-104 and IEC 61850 and publishes JSON on the same ISA-95 tree, buffering on disk while the internet is down. It also runs a local MQTT broker that Sparkplug nodes on an isolated plant network can publish to; Edge forwards their messages over TLS, and the cloud converts them exactly as above.

ConnectMQ Edge: PLCs, meters and OPC UA servers into your MQTT broker

Edge is one MQTT connection however many PLC tags it reads, which matters for connection-based pricing.

What you get when everything is ISA-95

Once Sparkplug devices, plain MQTT devices and PLC tags share one ISA-95 tree, the console builds a device tree, a live dashboard and a 3D digital twin from the topics alone, and alert rules work on any JSON field regardless of where it came from:

3D digital twin built from ISA-95 MQTT topics in ConnectMQ

Governance: one branch per consumer

A UNS without access control turns into a free-for-all. Give every consumer its own credential set and only its branch:

Consumer Subscribe Publish
Line 1 maintenance app connectmq/plant1/packing/line1/# –
Energy team acme/+/energy/# –
MES connectmq/#, acme/# acme/+/+/+/+/cmd
Analytics / AI agent connectmq/+/+/+/+/telemetry its own …/derived/… branch

Derived values (OEE, predictions) go to their own topics, never over device topics. With MQTT 5 shared subscriptions a high-volume consumer can scale out to several workers.

Checklist

  • [ ] Sparkplug group IDs named site_area
  • [ ] Aliases off in Ignition / MQTT Transmission
  • [ ] Plain MQTT devices on enterprise/site/area/line/device/kind
  • [ ] Status and config as retained messages; Last Will for offline
  • [ ] Consumers subscribe to JSON topics, Sparkplug hosts to spBv1.0/#
  • [ ] One credential set and ACL branch per consumer
  • [ ] Alerts on …/death topics

FAQ

How do I convert Sparkplug B to JSON?
Either run a decoder (Node-RED, Eclipse Tahu, a broker rule) or use a broker that publishes a JSON copy automatically. ConnectMQ converts every spBv1.0 message into JSON on an ISA-95 topic without configuration.

Does the conversion change the original Sparkplug B messages?
No. The original protobuf messages are delivered unchanged; the JSON copy is published in addition.

Can Sparkplug B and plain MQTT devices share one Unified Namespace?
Yes, as long as both end up in the same ISA-95 tree. That is the main reason to convert Sparkplug B topics into ISA-95 paths.

Why are some Ignition metrics missing in the JSON?
They were sent by alias only. Turn alias usage off in MQTT Transmission.

Docs for this post: Sparkplug B on ConnectMQ and Unified Namespace. You can try the whole flow on a free ConnectMQ broker with any Sparkplug B simulator.