Lagos, Nigeria
info@ezefidelity.com

Tech projects for IT leaders: How and why to add Node-RED to your home lab


Node-RED provides a sandbox in which you can experiment with the Internet of Things, basic programming and integrations between services.

node-red.jpg

Image: Node-RED.org

Like many technology leaders, I started my career with coding. I graduated college with “applied experience” in a basket of rather useless technologies, including Pascal, C, token ring networking, and LISP, but also had a solid foundation in the structured thinking and broadly applicable skills required to write functional code. These skills helped me end up at a professional services firm, writing applications using then-cutting edge technologies like Visual Basic and Microsoft Active Server Pages.

SEE: 5 Internet of Things (IoT) innovations (free PDF) (TechRepublic)

These days, it would be kind to call my coding skills rusty, and my job no longer entails getting near the inner workings of the technologies I specify. I still enjoy the thought process of designing and building applications, and I firmly believe it’s worth knowing the basics of how applications are built and integrated with modern technologies. Node-RED is an excellent platform for gaining that knowledge in your home lab.

Editor’s note: This is the third in an ongoing series of tech projects for IT leaders. See Monday’s installment: How to build a home lab, and Tuesday’s, Software for your home lab. Stay tuned for more projects in the future. 

Why Node-RED?

Node-RED describes itself as “low-code programming for event-driven applications.” I’d describe it as more of a programming Lego set, in which you can connect nodes that provide various functionality to execute a task and create your own function nodes that use JavaScript to perform whatever tasks you can imagine. Aside from the relative ease of designing functioning applications in an environment that looks like Microsoft Visio, what’s nice about Node-RED is that it strikes a sweet spot between letting you see under the hood of these technologies while eliminating a lot of the technical glue that makes it happen.

SEE: How to apply “platform thinking” to your tech strategy for greater success (TechRepublic)

How to install Node-RED

If you followed the Building your home lab tech project, installing Node-RED is as easy as grabbing a Docker container. If you’re using unRAID like I am, and have installed the Community Applications plugin, click the Apps tab, search for Node-RED, click the Install icon, and in a few minutes, you’ll have a configured and running Node-RED server. If you’re running another operating system on your home lab server, the Node-RED project homepage has detailed instructions for setting up your own Node-RED server on a variety of platforms.

To access your server using unRAID, click the Dashboard tab, click the Node-RED icon, and select WebUI, and you’ll be presented with a flowchart-like environment.

SEE: Want to build a home lab for containers and virtualization? Consider mini PCs (TechRepublic)

How to build your first flows

A Node-RED program is called a flow, an appropriate name since the tasks are structured in a flowchart-like sequence that can include decision points, branches and different paths based on the data that arrive at a particular node. Like many advanced tools, when I first fired up my Node-RED server, after a few moments of admiring the deceptively simple user interface, I scratched my head and wondered how to get started. While the official Node-RED homepage has a sample Getting Started flow, I’d suggest this tutorial that continues the tradition of creating a “Hello, world!” flow as your first program and explains the basic concepts of Node-RED flows.

The power of the palette

Once you’ve done a few variations of simple flows, you’ll hopefully start to see the power of Node-RED, mainly that you can create rather complex logical paths through simple flowchart mechanics. Where things become interesting is when you click the hamburger menu in the top-right corner and select Manage Palette. The palette is the collection of nodes that are available for you to use in your flows, and you can add new nodes from a vast library contributed by the community.

SEE: Try adding ambition to your department’s goals to gain better clarity (TechRepublic)

These community nodes can create neat integrations with many of the devices you already have in your home, allowing you to integrate and expand on the capabilities of individual devices. For example, we have automated deadbolt locks on our entry doors, which have a feature to auto-lock after 60 seconds and theoretically solve the problem of kids leaving doors unlocked. This is all well and good, but with three children and a dog, the front door is constantly being opened and closed. As you might imagine, when someone first unlocks and opens the door, the timer starts. Should someone else open the door, the deadbolt might extend as that same person is slamming the door as hard as possible, creating a nice deadbolt-shaped dent in the door trim.

Our locks and alarm system interface with our home automation system, where I could have tried my hand at learning a new programming language and writing some code to solve the problem. Rather than that approach, I added a set of nodes to interface with my home automation system. These nodes can get the status of various devices in my home and send commands to those devices. With about five minutes of thoughtful dragging and dropping, I had a flow that put some intelligence into the “auto-lock” feature and no longer have our door trim getting dinged.

screenshot-2021-02-25-082450.png

A simple flow to build some intelligence into our smart lock

Network-native

The other powerful element of Node-RED is that it speaks a variety of network protocols, allowing you to communicate with other public APIs, and even set up your own HTTP endpoint in seconds. For a practical application, our local school publishes its lunch menu to a service with a RESTful API that’s open to the public. I created an “http in” node that queried the API, connected a corresponding debug node, and quickly saw what kind of data I could get. I connected some additional nodes that allowed me to select tomorrow’s menu, filter out superfluous data, and send a message to our phones with the school lunch for the next day, allowing my wife and I to easily perform our nightly make-vs.-buy decision for the kids’ lunch.

SEE: Let go of perfection: Don’t waste time on projects that won’t yield much result (TechRepublic)

I’ve used similar functionality to translate GPS coordinates into addresses using Google APIs, automate lighting and other home automation functions, and even track the energy use and cost of our electric vehicles. These certainly aren’t mission-critical applications, but they allow you to activate your dormant coding skills and easily experiment with connecting various disparate services.

Practical Node-RED

Node-RED certainly wasn’t initially designed to turn on lights and have Alexa announce that tomorrow is pizza day at the kids’ school. Still, even these parlor tricks demonstrate the power of Node-RED: It allows you to quickly prototype and build integrations between different systems and services. Not only can you test a logical flow, and dramatically change the logic by moving a few lines on a screen, you can get a device that only speaks MQTT to react to anything from the weather in Timbuktu, to one of your enterprise APIs.

Node-RED is one of those great home lab tools that’s fun, reinvigorates atrophying technical skills and has real-world applications in an enterprise setting.

Also see



This post was written by and was first posted to TechRepublic



Do you find this article helpful? Your Friend might too. So, please Share it with them using the Share button above.
Will you like to get notified when I post new updates? Then Follow me on any of my social media handles: Google News, Telegram, WhatsApp, Twitter, Facebook, Pinterest.
You can also drop your email address below if you wish to be notified by mail.


Tags: ,

%d bloggers like this: