Creating Node Red Nodes

Node Red is an exciting platform for wiring together the Internet of Things or any web services. There is good documentation on writing your own nodes and a brief explaination on adding them to your Node Red install. Here are the brief steps to do this.

Node Red Installation Directory

After following the instructions to install Node Red on my Ubuntu system, the installation is at /usr/local/lib/node_modules/node-red and you’ll see a core directory there with the pre-installed nodes.

Local Nodes Directory

The nodes themselves are installed under the <install-dir>/nodes directory. The instructions for adding nodes recommends that you create a local .node-red directory and install your nodes there.

As part of my standard Node Red install, I now execute these commands after the install completes:

mkdir $HOME/.node-red
npm install -y node-gyp node-red-node-mongodb request thethingbox-node-timestamp node-red-contrib-deduplicate node-red-contrib-textbelt

Home Grown Nodes

If you’ve written your own nodes, simply copy the directory that follows the standard node structure to your $HOME/.node-red directory.

cp <my-node-dir> $HOME/.node-red/node_modules

Restart Node

With node directory copied, restart Node Red so that it will pickup your new node

sudo service nodered restart

Refresh the browser and you should see your new nodes.

Logging

If you use the log calls to troubleshoot your node development, you can file the messages written to the file:

/var/log/node-red.log

 

Leave a Reply

Your email address will not be published. Required fields are marked *