Yes, this works.
No, it is not what you think it is.
I went on to make an asynchronous subflow, which in reality is a upgrade to the grouping system. Doing so I accidentally allowed myself to mimic existing nodes, but with more than 1 input (or output).
I am not trying to spark a debate about a topic brought up this often. I just realised many people were asking or wondering about a node with multiple inputs.
The majority of posts I have read regarding multi inputs were about asynchronous inputs. This you can eassily solve using some merge, split and message properties. Now if we mix that idea with some links and illusions, then that gives us an async subflow with multiple inputs.
The plugin/node allows me to create any type of custom node with multiple in- and outputs. I just happen set the appearance of this node as a function node. Although in reality it's nothing more than native Node-RED nodes being smashed into together. This is why your flow remains working after deleting the plugin.
So what happens?
It's actually not really a custom node as much as it is not a multiple input node. There are some illusions going on. Which was my goal from the start; make it work without changing the philosophy and core of Node-Red.
Step 1
You start by making your set up in a flow. This can be whatever you like, however in this case I take the Bacon and Cheese example.
Each function has its specific code, example:
msg.payload = "bacon";
return msg;
Step 2
Create or drag your setup into a group. Right click the group and create a localflow.
Step 3
The group gets replaced by this localflow node.
Double click the node and click 'Edit localflow'.
Step 4
Edit the localflow to your desire. Add your in- and outputs and go back to your original flow.
Step 5
Connect your localflow node to the nodes you want.
Step 6
Change the appearance and name of your localflow node to your likings.
Done
You can see this as a seperate flow that lives inside your main flow. The in- and outputs are nothing but masked links that help sell the illusion of a multi input node. This is the main reason your flows remain functional even without the plugin, which helps you mask reality.
Additional things
- You can copy paste the localflow node to create multiple versions. Unlike a subflow, it's not an instance and changing one localflow does not change your copies.
- You can create unlimited localflows in a flow. However currently you cannot nest localflows inside localflows due to complex problems (for now).
- There is no input/output limit.
- Change input and outpunt names on the localflow node and inside the localflow.
- Your explorer will handle your localflow as a group:
What I am working on
- Solving edge cases and visual glitches. It happens that the facade is lifted during specific changes in your editor. None of these effect the functionality, however to remove the illusion of having a multi input node.
- Nesting localflows in localflows
- Saving localflows as a template, so you cansave them or drag them out of your pallete sidemenu on the left.
- Adding synced templates, where 1 change in your template changes them in all other templates with sync enabled.
Why?
This makes it possible to package complex logic into a single reusable node, keeping the main workspace clean and easy to understand. In practice, it is similar to creating a separate flow and connecting every input and output with link nodes. You can also see it as a group that is coated as a node. The difference with another flow is that localflow keeps everything inside the same flow, can be copied as a single unit, and behaves visually like a normal node.
I am sure there are many more use cases for localflow than the ones I have mentioned, and everyone will probably find their own way to use it. I mainly used multiple inputs as an example because it is a topic that comes up frequently in Node-RED discussions.
Your thoughts?
Let me know your thoughts on this proof-of-concept. Is it what you would've expected from a plugin attempt? Is it different? Would you use it, and why (not)?
I understand anyone disliking this as it might give the wrong impression of what is and what is not considered the idea behind Node-RED. It might even be confusing for anyone using it, that might think it's synchronous.
My thought on this matter is that despite staying true to Node-RED native features and philosophy, it does what many people discussed or requested in posts. This might satisfy their needs and since it is a optional plugin one can install, there is no downside for those that are against it.
Help me
If you enjoy my attempt at creating this abomination, feel free to message me if you would like to help test the plugin. I want to explore as many possible situations as I can before I can confidently say it works properly.
The main purpose of the Localflow project is not simply to add multiple inputs to a custom node. Its real purpose is to let you create a local flow inside your existing flow.
~ Stay positive please.

















