MQTT Engine Sparkplug behavior

Hi,

We are finding some strange behavior from MQTT Engine. We have our own Sparkplug Enabled application, written in python. We connect to the broker and have MQTT Engine as our Primary application. As a primary application, the MQTT Engine sends commands to our application, but not with the right alias.
We get the following metric from MQTT Engine as a command for our device:

So the metric.name is Node Control/Rebirth, as it should be. The metric.alias is 0, which should be 1, 0 being Node Control/Next Server. How is it that MQTT Engine loses this alias, or sends the wrong alias? This really seems like a MQTT Engine bug if I see it like this.

Fyi, we have set up the alias like this:

class AliasMap:
    Next_Server = 0
    Rebirth = 1
    Reboot = 2

# Set up the Node Controls
    addMetric(payload, "Node Control/Next Server", AliasMap.Next_Server, MetricDataType.Boolean, False)
    addMetric(payload, "Node Control/Rebirth", AliasMap.Rebirth, MetricDataType.Boolean, False)
    addMetric(payload, "Node Control/Reboot", AliasMap.Reboot, MetricDataType.Boolean, False)
2 Likes

I’d recommend turning up the SparkplugPayloadHandler logger to TRACE in Ignition and looking at the NBIRTH that arrives. What is Engine showing there?

We have done this @wes.johnson.

The birth message received is:

Incoming payload: SparkplugBPayload [timestamp=1661515406438, metrics=[Metric [name=bdSeq, alias=null, 
timestamp=1661515406438, dataType=Int64, isHistorical=null, isTransient=null, metaData=null, 
properties=null, value=0, isNull=false], Metric [name=Node Control/Next Server, alias=0, 
timestamp=1661515406438, dataType=Boolean, isHistorical=null, isTransient=null, metaData=null, 
properties=null, value=false, isNull=false], Metric [name=Node Control/Rebirth, alias=1, 
timestamp=1661515406438, dataType=Boolean, isHistorical=null, isTransient=null, metaData=null,
 properties=null, value=false, isNull=false], Metric [name=Node Control/Reboot, alias=2, 
timestamp=1661515406438, dataType=Boolean, isHistorical=null, isTransient=null, metaData=null, 
properties=null, value=false, isNull=false], Metric [name=_types_/myUDT, alias=null, 
timestamp=1661515406438, dataType=Template, isHistorical=null, isTransient=null, metaData=null,
 properties=null, value=Template [version=, templateRef=, isDefinition=true, 
metrics=[Metric [name=_Configuration, alias=null, timestamp=1661515406439, dataType=String, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=, isNull=false],
 Metric [name=_Status/Alarm_Y, alias=null, timestamp=1661515406439, dataType=Int16, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=0, isNull=false], 
Metric [name=_Status/Status_Y, alias=null, timestamp=1661515406439, dataType=Int16, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=0, isNull=false], 
Metric [name=output/ImageInfo_Y, alias=null, timestamp=1661515406439, dataType=String, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=, isNull=false], 
Metric [name=output/TotalFryCount_Y, alias=null, timestamp=1661515406440, dataType=Int16, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=0, isNull=false], 
Metric [name=output/JSDivergence_Y, alias=null, timestamp=1661515406440, dataType=Float, 
isHistorical=null, isTransient=null, metaData=null, properties=null, value=0.0, isNull=false], 
Metric [name=input/Acknowledge_DT, alias=null, timestamp=1661515406442, dataType=DateTime, 
isHistorical=null, isTransient=null, metaData=null, properties=null, 
value=Thu Jan 01 00:00:00 UTC 1970, isNull=false], Metric [name=input/Acknowledge_Y, alias=null, 
timestamp=1661515406443, dataType=Int16, isHistorical=null, isTransient=null, metaData=null, 
properties=null, value=0, isNull=false], Metric [name=input/Y, alias=null, timestamp=1661515406443, 
dataType=String, isHistorical=null, isTransient=null, metaData=null, properties=null, value=, 
isNull=false]], parameters=[Parameter [name=Line, type=String, value=], Parameter [name=Site, 
type=String, value=]]], isNull=false]], seq=0, uuid=null, body=null]

So we define that rebirth has alias 1.

Here we see how the rebirth is send from Ignition, but we don’t see any alias… Does this mean we can’t use aliases for Rebirth?

Ah right - yes this is in the current version of the spec:

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 for this is that Rebirths could be sent by a newly connected Host Application. It wouldn’t know about the previously reported aliases. The Edge Node needs to be able to respond to a non-aliased Rebirth request.

1 Like

Thanks @wes.johnson, that confirms our thoughts.