-
Notifications
You must be signed in to change notification settings - Fork 0
03 Sparkplug B Decode
MQTTProbe decodes Sparkplug B messages in real time, providing a structured view of your Sparkplug B topology including nodes, devices, and metrics.
Sparkplug B messages follow this topic structure:
spBv1.0/{group_id}/{message_type}/{eon_node_id}[/{device_id}]
| Verb | Sender | Description |
|---|---|---|
| NBIRTH | EoN Node | Node came online — includes full metric definitions with aliases |
| NDEATH | MQTT Broker (Last Will) | Node lost connection |
| NDATA | EoN Node | Periodic data update (alias-referenced) |
| DBIRTH | EoN Node | Field device came online |
| DDEATH | EoN Node | Field device went offline |
| DDATA | EoN Node | Periodic device data (alias-referenced) |
| NCMD | Primary App (SCADA) | Command to EoN node (observed, not acted) |
| DCMD | Primary App (SCADA) | Command to device via EoN node (observed, not acted) |
MQTTProbe parses incoming MQTT messages on topics starting with spBv1.0/:
- Splits the topic on
/ - Extracts: Group ID (segment 1), verb (segment 2), Node ID (segment 3), Device ID (segment 4, if present)
- Filters out
STATEtopics
The binary payload is decoded using Google.Protobuf (the Sparkplug B payload is Protocol Buffers encoded):
- Detects payload format (Sparkplug B binary, JSON, MessagePack, or plain text)
- Parses the protobuf payload into structured data
- Extracts metric values with their data types
| Code | Type | Code | Type |
|---|---|---|---|
| 0 | Unknown | 11 | Boolean |
| 1 | Int8 | 12 | String |
| 2 | Int16 | 13 | DateTime |
| 3 | Int32 | 14 | Text |
| 4 | Int64 | 15 | UUID |
| 5 | UInt8 | 16 | DataSet |
| 6 | UInt16 | 17 | Bytes |
| 7 | UInt32 | 18 | File |
| 8 | UInt64 | 19 | Template |
| 9 | Float | 20 | PropertySet |
| 10 | Double | 21 | PropertySetList |
Sparkplug B uses numeric aliases to save bandwidth. MQTTProbe maintains an alias map per node/device:
- During NBIRTH/DBIRTH: Aliases are learned from metric definitions
- During NDATA/DDATA: Metrics can be referenced by alias instead of name
- MQTTProbe resolves aliases back to human-readable names for display
The Sparkplug Nodes view shows your live Sparkplug B topology:
- Left panel: Nodes grouped by Group ID
- Right panel: Selected node details with metrics table and device accordion
| Status | Meaning |
|---|---|
| Online (green) | Node has sent NBIRTH and is active |
| Offline (red) | Node has sent NDEATH or lost connection |
| Unknown (gray) | Node has data but no NBIRTH received yet |
| Stale (yellow) | Node has received data but never sent a birth certificate |
- Group filter: Filter nodes by Group ID
- Text filter: Search nodes and devices by name
- Prune offline nodes: Remove offline nodes from the view
- Request Rebirth: Send an NCMD rebirth request to a node (30-second cooldown between requests)
- Real-time updates: Topology refreshes every 1 second
For each node or device, the metrics table shows:
- Name: Metric name
- Data Type: Sparkplug B data type
- Value: Current metric value (floats formatted to 4 decimal places)
- Last Updated: Timestamp of last received value
You can request a node to send a new NBIRTH by clicking Request Rebirth in the node detail panel. This publishes:
-
Topic:
spBv1.0/{groupId}/NCMD/{nodeId} -
Payload: Boolean metric
Node Control/Rebirth=true - Cooldown: 30 seconds between requests
MQTTProbe automatically detects payload formats in this order:
- Empty — No payload
-
Sparkplug B — Topic starts with
spBv1.0/ - MessagePack — MessagePack binary format
- Binary — Non-UTF8 content
- JSON — JSON object/array
- XML — XML declaration or tags
- Hex — Hex-encoded string
- Base64 — Base64-encoded string
- Plain Text — Everything else