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

Wrong historical flag #60

Closed ghocev1 closed 3 months ago

ghocev1 commented 3 months ago

Hello.

PLEASE change isHistorical flag with is_historical in MQTT Sparkplug B device. In the Sparkplug Specification clearly says that the every Metric must include a Sparkplug Datatype and each of the Sparkplug Datatypes is then represented by a Google Protobuf datatype. Only place where historical flag(isHistorical) is mention in example on Github but author of this example made a mistake, because this is not what Sparkplug Specification defines for sparkplug B Metric. image

I did test everything in Ignition SCADA and only is_historical is working." isHistorical" does not work.

Please repair this historical flag, if you do not believe me test (is_historical) this flag in Ignition SCADA.

Thank you for your answer.

thomassorensen2650 commented 3 months ago

The node is not encoding as isHistorian, that's handled by the official sparkplug-payload package.

But keep in mind that the message will be binary encoded when send over the wire, so it does not matter what its called in the client. I could add a warning if people tried to set is_historical (because it will be ignored), but thats about it.

What makes you think it's not working?

ghocev1 commented 3 months ago

Hello,

Thank you for your response. It has led me to believe that something might not be functioning correctly because I tested it in Ignition SCADA. I wouldn’t bother you if the isHistorical flag were working as expected. I’ve tried changing every possible property in Ignition SCADA, and the only flag that seems to work is is_historical.

I genuinely wouldn’t waste your time if I hadn’t explored every conceivable way to make historical data work in Ignition SCADA. I’ve also tested every Node for Sparkplug B that Node-RED offers.

May I kindly request that you test both flags, isHistorical and is_historical, in Ignition SCADA? It should only take about 10 minutes. I’m genuinely curious about how you managed to make isHistorical work in Ignition SCADA.

I know that you obtained this historian flag from the official Sparkplug payload, and I’ve carefully reviewed the code. Initially, I used the historian flag as isHistorical from the official Sparkplug payload. However, since it didn’t work in Ignition SCADA, I revisited the Sparkplug specification.

I believe that the creator (who is, after all, human and prone to mistakes) of the official Sparkplug payload may have made an error. The Sparkplug specification explicitly states that every metric must include a Sparkplug Datatype from the Sparkplug Protobuf Schema (I’ve read the specification five times now, primarily due to the historical flag).

If you recall, the old way to implement Sparkplug B in Node-RED involved using an MQTT node and then decoding it with the Sparkplug Protobuf Schema. I encourage you to open the Sparkplug Protobuf Schema to see how a Sparkplug B metric should be structured.

Additionally, I’ve explored Ignition’s MQTT Transmission module to understand which historical flag they use . Their isHistorical flag works only because they pack all the data into one metric. I’ve also manually tried this method with Sparkplug B out Node. MQTT Transmission

I’ve already figured out how to implement all the data types of MQTT Sparkplug B with the Sparkplug B out node; now I just need to create a reliable storage system. It would be easier for me to use your Sparkplug device node.

Thank you for your answer.

thomassorensen2650 commented 3 months ago

If you use the device node to buffer, what are you seeing in ignition? is MQTT engine configured to send historical data directly to history provider? anything in the Ignition logs?

If you purchased the ignition mqtt module, then I would contact cirrius-link support. or maybe ask for help on the cirrius-link forum.

ghocev1 commented 3 months ago

If I use the device node for buffering, I only see the last value from the buffer. I don’t have any faults in the Ignition log file. So far, I’ve found two ways that historian data works:

1.) The historical flag is set to is_historical. 2.) isHistorical works only if all data are packed into one metrics array.

Does buffered data with your Sparkplug Device work in your Ignition SCADA?

I will try to contact Cirrus-Link on their forum and ask them why their example isn’t in compliance with the MQTT Sparkplug B specification. I would kindly ask you that your Sparkplug B nodes at least do not block the is_historical flag. Meanwhile, I will try to discuss this issue with Cirrus-Link

The correct historical flag should be derived from the specification, not from an example. I will ask them to either change the example or the specifications because there should be no room for a misinterpretation.

thomassorensen2650 commented 3 months ago

I think you misunderstand how data is actually transferred. Protobuf is a binary protocol.. The attribute is_historian or isHistorian (and all the other attributes) are not transferred over the wire, it's just a human readable / json representation of the actual binary payload.

Also, I don’t understand what you are referring to when you say “one metric array” .

The node does not block anything, it passes whatever you send directly to the sparkplug-payload package, and that package requires you to call it isHistorical. Everything is working as expected.

If this does not work with Ignition, then you need cirrius-link (or someone that has the time and knowledge) to troubleshoot their module.

If Cirrus-link required historical data to be sent in a specific way, then we can look into modifying the code to send it that way. But I dont have the time to start troubleshooting the MQTT Engine module.

I will close this ticket, as there is no issue with this module as far as I can tell.