hotloop
GitHub

Integrations MQTT and Sparkplug B

MQTT and Sparkplug B

Verified live

Plain MQTT, or Sparkplug B as a full primary host application.

Verified against Eclipse Mosquitto 2.0, with crafted Tahu frames

As a primary host, the driver does the things the specification asks for and most integrations skip.

It publishes a retained STATE birth with a matching will, so edge nodes can see the host drop rather than inferring it from a timeout. The Sparkplug 3.0 form (spBv1.0/STATE/<host> carrying JSON) is the default, and legacyState selects the pre-3.0 ONLINE and OFFLINE string.

It tracks the per-node rolling sequence number and asks a node to rebirth when it skips, because a gap means messages were missed and the alias table can no longer be trusted.

It requests a rebirth after its own reconnect, because a host that was away has no idea what changed while it was gone.

It matches NDEATH to NBIRTH by bdSeq, so a death certificate left over from a previous session cannot kill the current one.

Addressing

AddressMeans
mqtt:plant/line1/temperatureA scalar payload.
mqtt:plant/line1/state|data.temperatureJSON, extracted by path.
mqtt:plant/+/flowWildcards work.
spb:GroupId|EdgeNodeId|DeviceId|Metric/NameA Sparkplug metric.
spb:Plant|Edge1||Node/UptimeAn empty device is a node-level metric.
The trap

Delivering Sparkplug messages concurrently reorders them, which makes a healthy node look like it is dropping messages and provokes a rebirth storm. Message ordering is enforced.

Configuration

legacyState