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

dynamic configuration of device name #49

Closed tobehn closed 4 months ago

tobehn commented 4 months ago

mqtt sparkplug device node I would need to have the opportunity to dynamically set the Name string for example by passing msg.device with a string as value into the node.

Currently the node takes the complete msg object to interpret the incoming spB message. This limits the flow of messages. Wouldn't it be great to use msg.payload to hold the spB content? This would open up the msg object for additional keys or objects like the device name.

tobehn commented 4 months ago

I am sorry for bugging you with this issue. I also found the Discussion section an promise to use it first before raising issues in future. Also i really want to thank you for creating these nodes. They make integrating SparkplugB a real joy.

You can make a dynamic device name happen with the command messages.

by sending the following command shortly after triggering the connection i can dynamically set the name of the device (where needs to be replaced with a STRING:

msg = {
    "command" : {
        "device" : {
            "set_name" : <NEW_NAME>
        }
    }
}   

This issue can be closed.