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

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

Alias for metrics breaks NBirth/NDeath certificates #64

Open archerixx opened 2 weeks ago

archerixx commented 2 weeks ago

Hi,

I am using Ignition as SCADA and so far I was using options to Disable BD Seq validation. I checked in your release logs that bdSeq should be working fine here, so I tried testing it out on my project.

I found out that when I am using Aliases, MQTT and SCADA do not recognize that Node is dead. But when I disable Aliases for Metris option, everything works fine.

Would you have any idea why this would be case? Is it possible to have it working with Aliases here ?

Here are logs of NBIRTH payload (with Aliases): {"timestamp":"2024-06-23T21:22:01.375Z","metrics":[{"value":false,"type":"Boolean","name":"Node Control/Rebirth","alias":{"low":2,"high":0,"unsigned":true}},{"value":{"low":0,"high":0,"unsigned":true},"type":"UInt64","name":"bdSeq","alias":{"low":1,"high":0,"unsigned":true}}],"seq":0} And NDEATH payload (with Aliases): {"timestamp":"2024-06-23T21:22:01.356Z","metrics":[{"value":{"low":0,"high":0,"unsigned":true},"type":"UInt64","alias":{"low":1,"high":0,"unsigned":true}}],"seq":0}

Here are logs of NBIRTH payload: {"timestamp":"2024-06-23T21:25:43.359Z","metrics":[{"value":false,"type":"Boolean","name":"Node Control/Rebirth"},{"value":{"low":0,"high":0,"unsigned":true},"type":"UInt64","name":"bdSeq"}],"seq":0} And NDEATH payload: {"timestamp":"2024-06-23T21:25:43.341Z","metrics":[{"value":{"low":0,"high":0,"unsigned":true},"type":"UInt64","name":"bdSeq"}],"seq":0}

Thanks in advance for looking into this

thomassorensen2650 commented 2 weeks ago

Strange.. Do you get any warnings/error messages in Ignition?

thomassorensen2650 commented 2 weeks ago

One issue I can see is that bdSeq is suppose to be INT64 and not UNIT64, but I don't think that is causing the issue you see.

From the example payload you send, it looks like the bdSeq in the NDEATH message matches the bdSeq in the BIRTH seq, so it should work.

From the Specification: Imediately upon reception of an Edge Node Death Certificate (NDEATH message) with a bdSeq number that matches the preceding bdSeq number in the NBIRTH, any Host Application subscribed to this Edge Node should set the data quality of all metrics to STALE and should note the timestamp when the NDEATH message was received.

archerixx commented 2 weeks ago

Last time I did it, there were not any warnings or errors in Ignition, but I will try running it tonight and post logs here

archerixx commented 2 weeks ago

My guess is that in NDEATH alias is not recognized since "name" is not being sent alongside it. In NBIRTH "name" is sent alongside alias. I understand that is how it should work with aliases, but maybe in these Certificate commands it does not work similarly.

thomassorensen2650 commented 2 days ago

I think I found the issue (bdseq was increased on rebirth). I'll see if I can release a new version with the fix soon.