[PSA] Setup tab in the function node

Just a PSA (public service announcement :'))

I don't know how often people use the 'Setup' tab in the function node, but it is truly amazing and perhaps underappreciated (?)

Example; I have a Milight which is a light that can be controlled via udp using some custom exotic protocol.

There are various milight node-red nodes available that either don't work or half work and all of them use a npm package that is maintained, but the node-red packages not so much.

So instead I use the setup tab, set the npm module name, and import it as the npm package describes it in the documentation, copy some example code, add it to the function, deploy, voila, works instantly and flawlessly.

Instead of waiting for nodes to be updated, this can be quick shortcut, sure it does not provide a nice interface to configure the thing, but that is usually a one-time setup and can be easily done in the code.

Given that there are 1.3 million npm packages available, you can make anything work.

To use this feature, set functionExternalModules: true, in settings.js (if not set) and restart node-red

And to make it "look" like a node, just convert the function node to a subflow, give it a nice color and icon and you have your own node-red-node

image

End of happy announcement :slight_smile:

5 Likes