Make Coreflux the namespace authority
TheSPARKPLUG_HOST route makes Coreflux the Sparkplug B Primary Host Application. It publishes authoritative host state, decodes the complete Sparkplug namespace, issues commands to edge nodes, and requests rebirth when it detects missing aliases or sequence gaps.
When to use it
Use this route when Coreflux must:- publish retained
STATEas the namespace’s Primary Host; - consume and decode all edge-node traffic;
- issue
NCMDandDCMDcommands from LoT; - detect sequence gaps and request a fresh BIRTH; or
- prevent two hosts from asserting the same Host ID.
Start with the broker where the Sparkplug edge nodes publish.
Quick Start
- Local broker
- Remote plant broker
- Declared command
Make Coreflux the Primary Host for edge nodes connected to its local broker:Coreflux publishes retained state at
spBv1.0/STATE/CorefluxHost and decodes the local namespace.Understand the Host role
A Host route connects two MQTT contexts:
The target and local brokers can be the same broker. If they differ, configure
SERVER to the broker used by the Sparkplug edge nodes.
Configure the Primary Host
There is no
MODE setting: SPARKPLUG_HOST defines the role.
Prevent Host ID conflicts
With the defaultHOST_ID_CONFLICT "REFUSE", Coreflux watches the configured state topic before asserting the role. If it sees a foreign online:true state for the same Host ID, it disconnects and stands down for that session.
Use WARN only when you know that the other state is stale and Coreflux should proceed.
Follow the STATE lifecycle
The Host route publishes retained state with QoS 1:- Before connecting, it registers an MQTT Will with
online:false. - After connecting, it publishes
online:trueusing the same session timestamp. - On graceful stop, it publishes
online:false. - After a crash, the target broker delivers the registered Will.
- After reconnecting, it publishes a new offline-to-online session state.
PRIMARY_HOST_ID use this state to decide when to publish.
Issue commands to edge nodes
The Host route supports two command methods.Use the convention topic tree
Publish a value on the local broker without declaring command metrics:NCMD; the device form sends DCMD. Coreflux uses the datatype learned from the target’s BIRTH catalogue.
This Action forwards a UI value to a node-level setpoint:
Declare a command overlay
UseADD METRIC when you need a friendly trigger topic, an explicit datatype, or commands before the first BIRTH:
The declared datatype takes precedence over a learned catalogue. If neither source provides a datatype, Coreflux drops the command instead of guessing.
Decode and repair the namespace
The Host route feeds the same readable topic tree as aSPARKPLUG_B decode route:
seq skips a value, Coreflux rate-limits and sends a node-level Node Control/Rebirth request.
Verify the Host route
1
Check route health
Publish the following command to Confirm
$SYS/Coreflux/Command:$SYS/Coreflux/Routes/PlantHost/status reports the target connection as active.2
Confirm Host state
Use any MQTT client connected to the target broker and subscribe to
spBv1.0/STATE/CorefluxHost. Confirm the retained payload reports online:true.3
Confirm decoded output
Subscribe to
sparkplug/decoded/# on the local Coreflux broker, then connect or rebirth an edge node.4
Test a command
Publish a correctly typed value to a convention or declared command topic and confirm the edge node receives
NCMD or DCMD.Troubleshooting
Host STATE is not published
Host STATE is not published
Confirm
SERVER, PORT, credentials, and TLS settings point to the broker used by the edge nodes. Check route status for a HOST_ID_CONFLICT refusal.No decoded data appears
No decoded data appears
Confirm edge nodes publish valid Sparkplug B traffic to the target broker and that no
SPARKPLUG_B decode consumer conflicts with this Host route.Commands are dropped
Commands are dropped
Use the correct convention topic or declared
COMMAND_TOPIC. If the edge node has not published BIRTH, declare the command with an explicit DATA_TYPE.Repeated rebirth requests occur
Repeated rebirth requests occur
Persistent alias or sequence gaps usually indicate an unstable edge node. Monitor decoded
$error topics and the route status.Limitations
Best Practices
- Keep
HOST_ID_CONFLICTset toREFUSEunless you intentionally take ownership. - Match every edge node’s
PRIMARY_HOST_IDto the Host route’sHOST_ID. - Point
SERVERat the broker where the edge nodes actually publish. - Prefer declared command overlays for production automations.
- Load credentials with
GET ENVandGET SECRET.
Next Steps
Configure Sparkplug B
Decode traffic or publish Coreflux metrics as an edge node.
Create LoT Actions
Automate decoded metrics and Sparkplug command topics.

