Closed alex-controlx closed 2 years ago
Hi Alex,
I think the easiest way would be to export the flow to JSON and edit the object there directly.
I've added an undocumented and untested feature with no input checks whatsoever to version v1.1.0. It only works if you set the definition before birth is send. use with extreme caution, but you should be able to set metric definition like this:
Edit: updated example to show correct syntax
msg.definition = {
"TEST": {
"dataType": "Int32"
}
}
msg.payload = {
"metrics" : [
{
name : "TEST",
value : 1
}
]
}
return msg;
I'll see if I can get it fully implemented in a future release.
Thank you for doing that. msg.definition
will simplify my work.
I guess dataType
property should have a value from the array at https://github.com/thomassorensen2650/node-red-contrib-mqtt-sparkplug-plus/blob/0543284ece8091372f22047b5f6e024bb0bb26b8/mqtt-sparkplug-plus.html#L355
On start I'll be sending the metrics definitions, then all metrics at last value, which should trigger the Device Birth message.
Correct, you can also send definition and the first payload in the same message.
This functionality has been fully implemented in version 1.2.0
Firstly, thank you for developing this valuable node!
A feature required in
mqtt sparkplug device
node: set metrics in programatically or via import and export from acsv
file.I have around 500 metrics and setting them up via the UI is very tedious.
Programatically it can be by sending a payload with an array of names and types for metrics.