Docs · Protocols
MQTT: publish templates and the Sparkplug B edge node
Publish templates
In the Publish dialog, give the message a Template name and click Save: topic, payload, format (text, JSON, hex, base64), QoS, retain and the MQTT 5 content type are saved with the connection. Template picks one again; Update, Save as new and the bin icon change or delete it. At most 100 templates per connection, payloads up to 64 KB.
Payload variables
With Expand variables (text and JSON payloads), these are replaced each time the message is sent:
| Variable | Becomes |
|---|---|
{{now}} |
the time in RFC 3339, UTC, milliseconds: 2026-11-07T10:30:00.123Z |
{{ts}} |
the time in milliseconds since 1970: 1794047400123 |
{{uuid}} |
a random UUID (version 4) |
{{counter}} |
1, 2, 3 … per connection, counted from when it was opened |
{{random:min:max}} |
a random number from min to max; whole numbers when both bounds are whole ({{random:1:10}}), else three decimals ({{random:0:1.5}}) |
This is plain text substitution of this list, nothing is run. Any other
{{…}}, or a {{ without }}, is refused with a message, so a typo does
not reach the broker. The write log records the payload as sent.
Repeat
Repeat sends the message every N milliseconds (100 ms to 1 hour), a given number of times or until stopped (Count 0). The first message goes out at once; a bar under the subscriptions shows the count and Stop repeat. A repeat stops by itself on the count, after 100 000 messages, after three failed publishes in a row, or when the connection closes or drops. Production connections need the name typed once, when it starts; the write log has one line for the start and one for the end.
Templates, variables and repeat are free.
Sparkplug B edge node simulator
Edge node… (next to Publish) defines and runs a simulated Sparkplug B edge node on the connection’s broker: for testing a SCADA or host application, a historian or a dashboard without hardware. Pro.
- Define the group id, edge node id, the period (100 ms or more) and the
metrics of the node and of its devices: name, Sparkplug data type
(Boolean, Int8 … UInt64, Float, Double, String, Text, DateTime), the
initial value, and a generator: constant, random walk (±step within
min..max), sine (min..max over a period in seconds) or counter (+step,
back to min above max), optionally a unit (sent as
engUnit). - Start opens a second MQTT session to the broker (client id
otdeck-edge-…) with the NDEATH as its will, subscribes to its NCMD and DCMD topics, then publishes NBIRTH and one DBIRTH per device. The app’s own session keeps showing the topic tree, so you see the node’s messages decoded in the Sparkplug tab. - Every period the generators step and the changed metrics go out in NDATA and DDATA, by alias only.
- Stop publishes NDEATH and disconnects. When the session drops without that, the broker publishes the NDEATH (the will), and the node reconnects by itself (1 s, 2 s, 4 s … up to a minute between attempts) as a new session: the next bdSeq, NBIRTH and the DBIRTHs again, metric values and the command log kept. The bar above the topic tree and the dialog say Reconnecting (attempt n) meanwhile and count the reconnects; each one is a line in the write log.
- The node follows the connection while it runs: made read-only, switched to production, or locked by a team policy, it stops (“refused”).
What it follows from Sparkplug 3.0:
- Topics
spBv1.0/<group>/<type>/<edge node>[/<device>]. - NBIRTH carries
bdSeq, seq 0,Node Control/Rebirth= false and every node metric with name, alias and value; DBIRTH every device metric. Births and data are QoS 0, not retained. - seq goes up by one with every message after NBIRTH and wraps from 255 to 0.
- NDEATH: QoS 1, not retained, the same
bdSeqas the NBIRTH of that session, no seq. A new session (the next Start) takes the next bdSeq. - Aliases are unique across the node and its devices.
- NCMD
Node Control/Rebirth= true: NBIRTH and DBIRTHs again (seq from 0, the same bdSeq), at most once a second: rebirth requests in between are answered by one set of births at the next period. - NCMD and DCMD writes by name or alias set the metric and are reported in NDATA/DDATA (at most every 200 ms; later ones go with the next period’s data); the dialog lists the last 50 commands with what happened (applied, unknown metric, unknown device …).
Not simulated: STATE of a primary host, DDEATH, historical or transient metrics, data sets, templates and arrays.
Production connections: the edge node publishes to a live broker, and host
applications may act on what it reports, so starting it needs the name
typed; read-only connections refuse it. Start and stop are in the write
log as sparkplug.edge.