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 broker configuration #50

Closed tobehn closed 4 months ago

tobehn commented 4 months ago

mqtt-sparkplug-broker node I would need to have the opportunity to dynamically set the Group string in the broker configuration node.

The Standard Node Red mqtt in node for example can be set to dynamic subscription and take a msg.broker object to define the whole configuration. Could this be a possibility to dynamically define and pass the group into the configuration node of the broker?

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 opens up the msg object for additional keys or objects.

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 Group configuration happen with the command messages.

by sending the following connection command on startup i can dynamically set the name of the group_id and the node_id (where needs to be replaced with a STRING of the node_id and with the group_id :

msg = {
    "command" : {
        "node" : {
            "set_name" : <NEW_NAME>,
            "set_group" : <NEW_GROUP>,
            "connect" : true
        }
    } 
} 

This issue can be closed