IMD SolutionComputing LibraryShop main store

Explainer

Rapid SCADA Sparkplug B decoding: why MQTT delivery is not enough

Edge computing and IIoT Published 6 min read By IMD Solution engineering team

Short answer

Receiving MQTT messages is not decoding them: Sparkplug B payloads are Protobuf-encoded, and a driver without a Sparkplug decoder produces no channel values no matter how the broker is tuned. The fix is a driver with explicit Sparkplug support or a decoding gateway that republishes values in a format your installed driver accepts, proven with one metric traced end to end.

On this page
  1. Delivery is not decoding
  2. The fixes that change nothing
  3. What the decoder must keep: births, aliases, state
  4. Worked example: one tank temperature from raw 235 to 23.5 °C
  5. Two places to put the decoder
  6. Prove the path, then scale it
  7. Questions asked

Your Rapid SCADA MQTT driver is receiving messages, and no channel value appears. That is not a broker fault. Sparkplug B encodes every metric in Protocol Buffers, and a driver without a Sparkplug decoder has nothing to hand those bytes to: MQTT delivery and payload decoding are separate stages, and only the first is working. The Rapid SCADA drivers available at present do not decode Sparkplug payloads, so the fix is a driver with explicit Sparkplug support or a decoding gateway that republishes values in a format your installed driver already accepts. The quantity to watch is not messages received but metrics correctly decoded into channel values.

Delivery is not decoding #

MQTT carries a payload as opaque bytes. A working connection and subscription prove the bytes travel; they say nothing about whether the receiver can interpret them. Sparkplug B packs each metric's name, alias, timestamp, data type and value into a Protobuf-encoded payload, so a usable receive path stacks three capabilities: MQTT transport, a Protobuf parse against the Sparkplug message definitions, and Sparkplug interpretation that turns decoded metrics into identified values.

A broker-side message counter proves only the first. When the counter climbs and the channel stays empty, the missing stage is decoding or interpretation, and no broker setting supplies it — a broker can be entirely Sparkplug-friendly at the transport level while not one subscriber decodes a metric, the same separation laid out in MQTT broker support is not Sparkplug support.

The fixes that change nothing #

Once messages arrive, the familiar transport fixes all land on the wrong layer:

  • Changing the broker address or credentials repairs connection failures, not the interpretation of a payload already received.
  • Raising timeouts helps when communication expires; it cannot turn binary data into engineering values.
  • Rewriting subscription filters helps when required topics are missing; it does nothing when the right messages arrive undecoded.
  • Viewing the payload as text shows unreadable characters by design, because a Protobuf message is not text; garbage on screen is not evidence of corruption on the wire.

Keep this failure distinct from a slow decoder. An overloaded decoder falls behind traffic and updates arrive late; an absent decoder never produces structured values at any message rate. The layering is the same on the device side, where the fault to repair is the client, as covered in fixing Sparkplug B device tags at the client, not the broker.

What the decoder must keep: births, aliases, state #

A correct Protobuf parse is only the middle stage, because the Sparkplug operational behavior makes every payload depend on session state:

  • The device's DBIRTH payload must itself be a Sparkplug payload, and the publisher retains its birth messages, so a subscriber that joins late can still read the declaration of each metric's name, data type and alias.
  • A metric may send an alias in place of its full name on later data messages. An alias resolves only against the birth that defined it, so a receiver that missed the birth sees updates it cannot name — the resolution mechanics are detailed in decoding Sparkplug MQTT payloads and resolving aliases.
  • The publisher's liveness is part of the same state machine: the will message registered at CONNECT announces its death, and what it published must be treated accordingly.

A stateless byte-to-value converter therefore decodes one message and fails at the first publisher restart, alias change or receiver reconnect. The parse itself also fails outright when the message definition does not match the payload — the failure mode behind resolving Protobuf parsing errors on NBIRTH messages.

Worked example: one tank temperature from raw 235 to 23.5 °C #

Trace one metric through the whole path before touching the wider configuration. The values below are illustrative example inputs, not site measurements; on a real project each comes from the publisher's documentation and from the bytes the publisher actually sends.

Inputs:

  • The metric: tank temperature, published as an integer in tenths of a degree Celsius. Example raw value: 235.
  • The scale factor: 0.1 °C per count, taken from that documented encoding.
  • A companion metric: discharge pressure, published as an integer in tenths of a bar, example raw value 42, included so the test proves identities stay distinct.
  • The expected channel values: 23.5 °C and 4.2 bar.

The rule, in words: the engineering value equals the raw integer multiplied by the documented scale factor, and the channel must show exactly that number with the metric's type preserved — the receiver changes nothing unless a conversion is documented.

The arithmetic:

  • Temperature: 235 × 0.1 °C per count = 23.5 °C.
  • Pressure: 42 × 0.1 bar per count = 4.2 bar.

The result and the decision: accept the decode path only when both values land in their own channels exactly — zero mismatches across the two-metric set — and the same holds after a receiver restart. One deviation rejects the path, and the deviation says where the fault is: 235 on screen means the scale was dropped; 4.2 bar in the temperature channel means alias or birth state is wrong; an untouched channel means the decode stage is still absent.

Two places to put the decoder #

A native driver performs the Protobuf parse, the Sparkplug state handling and the channel updates inside Rapid SCADA itself — one component, one set of diagnostics. It has to exist for your installed version first: check that driver's documentation, because MQTT support and Sparkplug support are separate capabilities, and if the documentation does not name Sparkplug, the driver does not decode it. Writing a new driver or extending an existing one is real but bounded work, and whoever commissions it owns it across later Rapid SCADA releases.

A decoding gateway sits upstream instead. It subscribes to the Sparkplug topics, keeps the birth state, decodes, and republishes plain values — JSON is the usual choice — on topics the installed driver demonstrably accepts; a Node-RED flow is the common shape. The gateway then becomes part of the maintained system: its configuration, diagnostics, restart behavior and deployment package belong in the system documentation exactly like a custom driver.

The decision: if the driver documentation for your installed version names Sparkplug decoding, commission the native driver; otherwise deploy the gateway and own it. Do not stay on a raw-bytes driver hoping a setting appears.

Prove the path, then scale it #

  • Capture a representative sequence — the birth messages plus later data — with a separate diagnostic subscriber, so the production subscription is untouched.
  • Change the test metric safely at the source — a simulated value or a spare register, never a running control loop — and compare publisher value, decoded value and displayed channel; check type and scale, not just magnitude.
  • Run both metrics at once so one update cannot quietly land in another channel.
  • Restart the receiver and repeat: birth and alias state must rebuild, and an unresolved metric must never be written to an arbitrary channel.
  • Widen the mapping to the full metric set only after both metrics survive the restart.

Questions asked

Can the broker itself decode Sparkplug before Rapid SCADA sees it?

Some brokers and broker add-ons can run a rule or script that republishes a decoded copy of each message. That works only if the output format is one your installed driver accepts and if the script keeps Sparkplug session state — retained births, alias resolution, publisher death — otherwise it fails at the first restart exactly like a stateless converter. Treat it as the same maintained component as a gateway.

Will upgrading Rapid SCADA or its MQTT driver add Sparkplug decoding?

Only when the release notes or driver documentation for that exact version name Sparkplug support explicitly. MQTT connectivity and Sparkplug decoding are separate capabilities, so an upgrade that improves connections, queuing or TLS changes nothing here. Record the installed Rapid SCADA and driver versions, check the documentation for those versions, and treat the upgrade as the fix only if decoding is listed.

How do I test the decode path without touching the live publisher?

Record a real message sequence — birth messages followed by data — from the production broker with a diagnostic subscriber, then replay it against a test broker and point the gateway or driver at that. The decoder cannot distinguish replayed bytes from live ones, so decoding, alias resolution and channel mapping can be proven offline and the test repeated after every configuration change.

Why test two metrics instead of one?

A single metric can pass while the mapping is wrong: an unresolved alias can drop a plausible value into whatever channel the mapping happens to touch, and nothing contradicts it. A second metric with a different engineering unit exposes that immediately, because each value has exactly one channel it can legitimately occupy. Two is the minimum for the first commissioning pass; expand only after both survive a receiver restart.

Keep reading

  • How-to

    Sending Sparkplug B payloads over an MQTT WebSocket client

    Yes. A WebSocket MQTT client carries Sparkplug B traffic as long as it transports payloads as binary, because the Sparkplug B payload is a protobuf byte sequence that must not pass through text conversion. Decide who encodes and decodes: your application or a component that documents Sparkplug support, then verify byte-for-byte passthrough on the deployed version.

    Edge computing and IIoT

  • Troubleshooting

    Why Ignition Edge MQTT payloads look like unreadable bytes

    The unreadable characters are Sparkplug B's Protocol Buffers encoding rendered as text, which means the broker delivered the message intact. Fix the subscriber: select the Sparkplug decoder in MQTT.fx or use a Sparkplug-capable release such as MQTT Explorer v0.4.0-beta4. Leave the Edge Transmission format and the broker unchanged.

    Edge computing and IIoT

  • Explainer

    Exporting Sparkplug B out of Geo SCADA to a historian

    No modified DDK driver will push Sparkplug B out of Geo SCADA, because the driver layer is pull-only in the outbound direction. Build the publisher on the Client API Sample DataFeeder pattern, which watches about 100,000 points per instance; for millions of points, use HSI or a database-level connector.

    Edge computing and IIoT

Why Citect alarms do not appear in AVEVA Historian