IMD SolutionComputing LibraryShop main store

Troubleshooting

Why the Rebirth metric arrives without its Sparkplug alias

Edge computing and IIoT Published 5 min read

Short answer

The command is correct: Sparkplug B forbids an alias on Node Control/Rebirth in NBIRTH, so a host sends that NCMD by full name with the alias field unset, and your decoder prints 0 because an unset numeric protobuf field reads as 0. Delete the alias from the Rebirth metric in your birth payload and dispatch the command by name on the node.

On this page
  1. The rule in the specification
  2. Why the decode prints 0
  3. Your alias map on the wire
  4. Verify what actually crossed the wire
  5. Fix the edge node
  6. The decision for each case
  7. Questions asked

The command you captured is correct as sent. MQTT Engine published Node Control/Rebirth by its full name with the alias field unset, which is exactly what the Sparkplug B specification requires of a node that uses aliases: the Rebirth control metric in NBIRTH carries no alias. The 0 in your decode is the default value of an unset numeric protobuf field, not the host addressing Next Server. Two changes on your side close it: stop writing an alias into the Rebirth metric of your NBIRTH, and dispatch that command by name.

The rule in the specification #

A birth certificate declares every metric with its name, data type and, where aliases are used, its numeric alias, so later data messages can carry the short number instead of the full name. One metric is exempt. In the specification's words, when aliases are being used by an Edge Node an NBIRTH message MUST NOT include an alias for the "Node Control/Rebirth" metric.

The reason is connect order. A Host Application can attach to the broker after your node already published its birth data; that host has never seen your alias map, and the one command it must be able to send immediately is a rebirth request, carried as an NCMD metric named Node Control/Rebirth with a Boolean value of true. The request therefore travels by name, and the node must act on it without alias resolution. Connect ordering decides this whole area; it is also why a broker rejects a Sparkplug client over its STATE will topic. So MQTT Engine lost nothing: it addressed the command the only way the specification lets a host address it.

Why the decode prints 0 #

Alias is an optional field in the protobuf Metric message. A sender that leaves it out transmits nothing for it, and a decode that reports the default of an unset numeric field prints 0. Your map starts numbering at 0 and assigns that value to Next Server, so the decoded command looks as if it addresses the wrong control. Nothing was corrupted: the field was never on the wire. Telling the two apart is a presence check, not a value check, because a transmitted 0 and a defaulted 0 are the same number in a decoded dict.

Your alias map on the wire #

Your captured NBIRTH is the part that violates the rule: it declares alias 1 on Rebirth. Transmitted correctly, the node control block looks like this:

Metric Alias in your code Alias in a compliant NBIRTH
bdSeq none none
Node Control/Next Server 0 0
Node Control/Rebirth 1 none, field omitted
Node Control/Reboot 2 2

Count the identifiers. Your three control metrics configure 3 aliases, and a compliant NBIRTH transmits 3 - 1 = 2 of them, because Rebirth's is withheld. The host's alias table after your birth holds two entries, 0 for Next Server and 2 for Reboot, and the identifier 1 you configured is never seen on the wire. The NCMD that returns carries the name Node Control/Rebirth, data type Boolean, value true and no alias, so your dispatch has to find it by name and will find nothing for it in the alias map.

Verify what actually crossed the wire #

This sequence assumes commands reach the node; when the node sends data but nothing comes back at all, that is the separate case where Sparkplug B sends data but receives no SCADA commands.

  1. Set the SparkplugPayloadHandler logger to TRACE in Ignition and reconnect the node.
  2. Capture the NBIRTH it publishes.
  3. Read the trace: Node Control/Rebirth present by name with no alias, Next Server on 0, Reboot on 2, and bdSeq also appearing without an alias.
  4. Trigger a rebirth from the host and read the traced NCMD: name Node Control/Rebirth, Boolean, value true, alias unset.
  5. Compare the traced payload against your Python decode; if the trace shows no alias and your dict shows 0, your decoder is printing the default.
  6. If the rebirth request never arrives at the node, that is a delivery failure rather than an alias question, and troubleshooting Sparkplug rebirth command losses covers that path.

Test dispatch with Rebirth requests rather than Reboot: the Reboot control does to the node what its name says.

Fix the edge node #

On the edge side, the control path must not depend on alias resolution:

  • Dispatch on the full metric name first. Node Control/Rebirth routes straight to the rebirth action, and the alias lookup keeps serving data metrics, Next Server and Reboot.
  • Delete the alias argument from the Rebirth metric in your NBIRTH builder, so the transmitted birth matches the compliant column above.
  • Do not substitute alias 0 from map position; a command with the alias unset is, by definition, addressed by name.

Give device-level control the same discipline. The specification's device examples use a control metric written Device Control / Rebirth, and name-first dispatch costs nothing there. If, once the birth payload is corrected, the host answers every NBIRTH with another rebirth request, that loop has causes of its own; start with resolving continuous Sparkplug rebirth requests.

The decision for each case #

  • Your NBIRTH carries alias 1 on Rebirth, as in the payload you captured: delete it. That is the specification violation, and with it gone the host's by-name command matches your node.
  • Your NBIRTH is already compliant and the NCMD still decodes as alias 0: treat the 0 as unset and match on Node Control/Rebirth. Route nothing to Next Server.
  • You cannot tell what was transmitted: trace it. The decoded dict cannot distinguish a transmitted 0 from a defaulted one, the traced payload can, and the same trace-first step applies when payloads fail to parse at all, as in resolving protobuf parsing errors in NBIRTH payloads.

Questions asked

Should Node Control/Rebirth carry an alias in NBIRTH?

No. Whenever the node uses aliases at all, this one metric goes out with the alias field unset, while Next Server and Reboot keep theirs. A host that connects after the birth has never seen the alias map, so the one command it must be able to send immediately travels by full name. A node that uses no aliases anywhere is outside the clause.

Why does the NCMD decode with alias 0 when 0 belongs to Next Server?

Because 0 is what a decode reports for an unset numeric protobuf field. The host omitted the field on purpose, and your map happens to start numbering at 0, so the default collides with Next Server's identifier. To prove the field was never transmitted, check field presence through your protobuf library or read the traced payload bytes.

Where do I see the birth payload the host actually received?

Run the trace sequence in the verify section: one capture after reconnecting the node lists each metric with its name, alias and data type, with Rebirth present by name with no alias, Next Server on 0 and Reboot on 2. The same trace shows the NCMD the host sends back, so it covers both directions.

What breaks if my node only accepts Rebirth with alias 1?

Every compliant host stops being able to refresh the node. The command arrives by name with no alias, your dispatcher finds no match, the request is dropped, and the host keeps working from stale birth data, which you see as a node that never refreshes after the host reconnects. Route the named metric to the rebirth action before any alias lookup.

Keep reading

  • Troubleshooting

    Sparkplug B sends data but receives no SCADA commands

    Sparkplug B telemetry that reaches SCADA while SCADA writes never arrive is usually a direction-of-function fault: the open-source IEC SparkplugB library V1.0.0.0 implements only sending controller data to SCADA. Verify the broker path, session and authorization, watch the 30-minute demo window of the MQTT Client SL dependency, and choose a documented receive-capable implementation when writes are required.

    Edge computing and IIoT

  • Troubleshooting

    Fix MQTT sensor data missing in Node-RED

    A green MQTT connection in Node-RED proves only a broker session, not that the GSM module published a value or that the flow subscribes to its topic. An http in node cannot receive MQTT publications at all: use an mqtt in node. Trace RS-485 acquisition, publish result, broker identity and topic match in order, and fix the first stage with no positive result.

    Edge computing and IIoT

  • Troubleshooting

    Troubleshoot missing data in a Node-RED InfluxDB Grafana stack

    Work the chain in order: acquisition into Node-RED, the InfluxDB service and its storage mount, the write settings, then the Grafana query. In a 2.x stack most empty panels trace to a wrong token, bucket, URL or a controller clock that stamps points outside the panel's time range.

    Edge computing and IIoT