Node Red is very powerful, but can be confusing to use, because it’s a completely different way to approach coding. Node Red is a flow-based low-code platform which essentially means that you base behavior based on a set of different flows and use less code than traditional software development. Although it’s taken a strong foothold in the Internet of Things ecosystem, it’s useful in other contexts as well. This article will be one of many node red tutorials.
Input, Process, Output and how it applies to Node Red
At its most basic level you can break down an app in Node Red by getting as granular as possible. For every basic procedure, you have some form of input, mostly data or input coming from a user, a processing portion where you do something to that data, and then an output. That output could be accepted as an input and then you’d do the same cycle over and over again until you meet the end goal that you’re trying to achieve.
For instance, maybe you have a rain sensor outside of your home and when it rains you want to turn on the lights outside of your home. The first thing is you want to check if the rain sensor says that it’s raining, so you have that sensor send out a message to everyone that’s interested that there is rain. That now is the input to next step, which you’ll then check for instance if the lights are not turned on, that’s the process part, now if the lights are not turned on, then you get that output and send a message as an input to a “Turn On” function of say a smart switch that’ll turn your lights on.
So essentially what you have is something like the following:
Just always think in those terms and you can break down any problem.
Using the previous example, that will look like the following:
Receive Input From Rain Sensor > Output of that is now Input > Process to check if lights are on > Send a message to the “Turn On” function of smart switch.
I hope this will help you grasp at the highest level how to plan your app in node red.