These nodes are not exactly the same, But for some reason I can’t get 2 seperate configuration to work on the same flow?
These nodes are not exactly the same, But for some reason I can’t get 2 seperate configuration to work on the same flow?
Having nodes on 1 flow or two makes no difference. None.
Flows are there only for us humans to make organization better. I have a flow with over 100 nodes on it, much scrolling to move around, so that’s not got anything to do with why they are not working.
So, with that said… Lets dig into the flow.
Your two green debugs, have you moved them to the output of the function nodes and checked whats going into each blue node?
When debugging, its really important to know whats going into a node as well as whats coming out of the node.
What is the blue node? I’d be happy to install it and take a look at it, but will need to know what you are injecting to it.
Thanks, The 2 blue nodes at the end are MQTT Broker configurations, I need 2 of them because they have small differences. But Node Red tell me that (2) nodes use this configuration. When I make a change to one it actually makes the change to both.
I guess I could actually combine all the DATA into a single configurations but that just seems to be an odd way of doing it.
Ah, no, that makes perfect sense now.
You should only have one of them and just setup each function node to make the required payload for its group of nodes (its msg.payload) and take the output of all the different function nodes you need and put it into the one MQTT node.
I have used nodes like that. You can only have one of them per Node-RED. Even if you have 100 flows, you should use the ‘link’ node to go send the payload from what ever flow you are on, to that one node.
The example that springs to mind is the worldmap node. You can only have 1 in the entire project.
OK, thanks again, you have been great help and I will correct.
I think that your issue is that you only have 1 configuration being used by the two nodes. You can easily create another configuration and apply it.
For the first SPB node I have this configuration
For the second SPB node I have a very different configuration
You can also see that I have TWO configurations listed in the sidebar not one.
This is because node-red handles configurations completely separate from a node that can apply a configuration. Think of the nodes as functions in a program. you call the “function” by placing it on the field, you pass the function params by wiring it up to a sequence that will produce the msg.topic and msg.payload you want to pass into that function, and it then returns - whatever that node is designed to do. Each node is totally agnostic of the nodes before it and after it. It only cares about the params its passed by a msg object. And as soon as it returns, its a blank slate waiting for another event of params to handle again.
A configuration object, is a list of parameters a node will use when it is called. This allows a single configuration to be used by multiple instances of a node, as in your case. Or for multiple configurations to exist and dynamic params to dictate using one configuration or another. this also allows configurations shared to multiple flows to be used. additionally, you will notice with time, that deleting a node with a configuration - from your flow or even removing the NPM package adding the nodes to your palette, will leave the configuration objects in your sidebar. This is because handling the config objects this way allows for even different nodes written by different programmer and contributed to node-red can use a config object from another node - or could be prevented from sharing configurations and config info to users that have not been authorized to view.
I am explaining this because it might help someone - especially someone from PAC control or PLC programming to better anticipate how node-red works. While it is fairly simple - its easy to overlook some powerful functionality.
What you want to do is open your sparkplug node to edit it, hit the dropdown menu where your broker config is named, and select “add new mqtt-sparkplug broker” it will show a red outline around it. Click the pen icon to the right to edit and then save that new broker config. Then set up your two instances of SPB by selecting the correct config from the dropdown box
Thanks so much, this is very useful information.