thomassorensen2650 / node-red-contrib-mqtt-sparkplug-plus

A node that makes it simple to implement MQTT Sparkplug in Node-Red
23 stars 7 forks source link

NBIRTH does not contain metrics #6

Closed ciderglider closed 2 years ago

ciderglider commented 2 years ago

I have installed your example code into node-red.

When the mqtt sparkplug device connects to the MQTT broker, it sends an NBIRTH message, but the message does not contain the metrics configured in the node, i.e. testing/test1 and testing/test2. The NBIRTH does contain 2 metrics:

Is there something I need to do to get the metric into the NBIRTH message, or is this part of the Sparkplug protocol not implemented?

thomassorensen2650 commented 2 years ago

The NBIRTH is BIRTH of the EoN Node (Node-Red) and would normally be reserved for system function (e.g rebirth or reboot, etc.), your metrics should be defined in the birth (DBIRTH) of one or more device(s) (Device is a "MQTT Sparkplug Device" node in Node-Red).

If you inject the input to the Device in the example then it will send a DBIRTH with the metrics.

I can see that I should probably modify the example to show how multiple devices and also MQTT In and MQTT nodes can use a shared MQTT Broker Connection. Basically the nodes follow the same concept as the builtin MQTT nodes in Node-Red

There are no way to add custom metrics to the EoN node level at the moment, and I'd need a really good argument to implement this, as it would add a lot of unnecessary complexity and it would not be useful for most people (I might be wrong on this one).