Multiple Instances of the Same Flow?

I wasn't sure where this belonged as it plays into the flows and dashboard as well.

Basically I have 12 ethernet cables in the test department of my company. We have a few different varieties of controllers that get plugged into them, all with their own specific modbus maps. Currently, I have a flow working that knows what controller gets connected, switches the modbus map, and starts data logging. I have made up a dashboard that can be used to observe the unit when not in front of it.

Now that I have a working set of flows and a dashboard, is there any way I can instantiate it such that I don't have to copy and paste it all 12 times? The only difference between all 12 of the flows would be the ethernet IP address used to communicate over modbus TCP. The IP is also used as the title for the dashboard. I added an image below to help make my intentions more clear. Ideally all 12 IP addresses would be listed on the left.

If I want to change anything down the road, which I will, its going to be an absolute nightmare.

Any suggestions are greatly appreciated!


You could run as many copies of Node-RED simultaneously as needed by using the command line.

You can specify the TCP/IP port using the '-p' parameter as well as starting a different flow or project.

All of these copies / instances of node-red can push data into a single dashboard if you want - or different dashboard.

Note that each instance of node-red needs to be assigned a DIFFERENT port (e.g. 1880, 1881, 1882 etc.). If the ports are not unique the instance will not start.



BTW: you can store the 'configuration' of the IP addresses / ports / project etc. using a dashboard. This means it could be flexible enough yet have defaults...


Paul, I appreciate the response, however either I do not fully understand what you're saying, or I'm not explaining myself well enough.

I've attached my flows below to help explain, please see the two separate tabs labeled "" and "". The first flow communicates with a device at IP and the second with a device

I do not need to change the IP address of Node Red itself, but rather the IP addresses that control the modbus communications and the text that shows the IP address on the dashboards.

Unless there is a way to utilize a variable or global/flow object to dictate the IP address that the modbus nodes look at, I don't see how I can make this work. There are 20+ locations in the flow where the IP/dashboard need to be changed. This is fairly time consuming. Right now I would have to copy my flow 12 times and change the IP on all the nodes 12 times. If I need to make any changes at all I would have to manually replicate the changes across all 12 flows. In the future we will most likely have 20 or more separate IP addresses that I need to pull modbus registers from.

In addition to the flow itself, duplicating the dashboard arrangement after copying the flow is time consuming as well.

flows (1).json (77.5 KB)

The fastest way I've found to do this at this point is to copy the raw code, do a find and replace with the IP address and reimport, however, this still requires me to reorganize the dashboard layout, for whatever reason it gets messed up on import.

Just a quick idea. Couldn't you assign a topic to each IP and then filter by topic in the rest of the flow?


Could you please explain a little more what you mean by "filter by topic in the rest of the flow"? This is only my second day playing with this so I'm still a rookie.

Set the IP in the message:

msg.payload.IP = <IP for this message>


I'm not sure how this can be used to modify the modbus IP address though. I think I understand what you're getting at for filtering the data when I bring it in, but its still going to require literally 100s of modbus nodes that I have to copy and paste a dozen times when I duplicate the code.

If there is a way to change the IP address on this modbus node through a variable or msg then that would be helpful.

I've found this module that allows you to inject the IP address, however I think it might be broken as I have had no luck getting it to work and it doesn't appear as though there is much support for it.

This is basically what I need.

Still looking for solutions here... Surely there has to be some way to easily manage multiple dashboards and modbus units..

Are you intending one dashboard box to view one subset of controllers (eg per floor) - or any dashboard to be able to see any collection of modbus devices ?

If the former then you can use environment variables to configure the display device - Using environment variables : Node-RED to set hem outside of Node-RED so that device is then configured for that set of controllers.

If the latter then really yes you probably are into cut/paste territory so that other displays can also select which view they wish to view simultaneously.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.