Node-RED Feature: Packaging a subflow as a module

So have been playing around with this lately and it is an interesting capability for those of us that have several distributions (HE + Node-RED) out in the wild.

https://nodered.org/docs/creating-nodes/subflow-modules

Works great so far..

2 Likes

To elaborate a little more:

  • I created a folder in my node-red user home called~/projects/erktreks-cool-node/
  • Followed the directions, did the npm init thing etc etc.
  • made sure to configure the subflow with category and info before copying and saving to example.js. Also saved a copy so I could restore the subflow as needed.
  • removed subflow and installed subflow node like this:
npm install ~/projects/erktreks-cool-node
  • To remove the subflow:
npm remove erktreks-cool-node
  • To update the subflow, make desired changes in subflow node dir, up the version number and do this:
npm update erktreks-cool-node
  • make sure you restart Node-RED after each update/remove/install!

The reason this is nice for client setups (for example) is subflows that are "node-ified" are harder to change but relatively easy to update remotely. Helps keep things consistent across installations for easier support.

Note: For subflows that reference specific HE hub devices or other servers it's probably not a good fit. Configuration is a little limited right now.

1 Like

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