To administer node-red you will need to go the admin url.
The admin url is the machine name or IP address followed by the port number. e.g
- 127.0.0.1:1880/ if you are running the browser on the same machines as node-red.
- localhost:1880/ –
- steve-laptop:1880/ when running node-red on a remote machine
I currently run node-red on a Raspberry Pi and use a second machine (windows 10) to create flows.
Using The Node Red Admin User Interface (UI)
When you open the node-red admin screen for the first time you should start with an empty work space as shown in the earlier screen shot above.
The default view is a three column layout with nodes on the left ,the flows work space in the middle and a third column on the right.
The third column or output pane has two or three tabs – info, debug and dashboard ( if installed).
Note: In versions 0.19 and above there are now 5 tabs. The two new ones are the configuration tab and the context tab.
A flow is a collection of nodes wired together and functioning as an application or program.
The node-red workspace supports multiple flows which all share the same nodejs event loop.
Nodes are the basic building block of node-red.
A node is effectively a software block that processes messages.
A node can have inputs and outputs which enable messages to be passed between nodes.
An input can accept connections from multiple nodes and an output can output to multiple nodes.
The nodes in the left pane are arranged in categories.
A node-red installation will contain core nodes and the nodes are organized into groups
There is a
- input group
- output group
- functional nodes
- dashboard or display nodes
Other groups can be created when new nodes are installed.
Here is a quick overview video that shows how to create a basic flow.
Each node has a well defined function and contains its own data.
You can install additional nodes using either the npm package manager or using the Admin Interface.
Frequently Used Nodes
There are two nodes that you will find yourself using quite often.
They are the debug node and the inject node.
The Inject Node
Node-Red is an event based system and something must happen to create an event.
The inject nodes will fire a message ( msg) into the next node and this is used to trigger a flow.
The debug node is used for displaying output for debugging purposes.
By default it will display the message payload but can be configured to display the entire message object.
Beginners Guide to Node Red Inject and Debug Nodes- Video
You should notice a green box next to the debug node clicking this will toggle to debug node output on/off.
Dark green is on and light green is off.
Note: On Node-red version 1 the default setting is disabled. So if you aren’t seeing debug messages check the status of the debug node.
If you double click on the node on the canvas then you can edit the node properties.
All Nodes have a name property. This is the name that is displayed on the canvas.
It is also possible to disable some nodes. You can see the button in the lower left corner when you edit the node.
A Basic Flow
You can wire the inject node into the debug node to create a basic flow as shown below.
The above flow will inject a unix timestamp into the debug node which can be viewed in the debug tab in the far right pane.
When you start node red then all currently enabled flows are automatically started.
If you edit or create a new flow you will need to deploy it using the deploy button.
The Deploy button on the top right change from grey to maroon when changes have been made to a flow to indicate that in it needs to be deployed.
You can choose to deploy all flows in the workspace, modified flows,modified nodes or restart flows.
Working With Flows
The workspace consists of all of your flows.
Along the top of the workspace pane are tabs that are used to open previously created flows.
You can create new Flows by clicking on the Plus button on the top right.
When you create a new empty Flow it is given a default name and is enabled by default.
Generally you create a new flow when the flow needs to do a distinct task.
To add nodes to a flow drag them from the node palette on the left into the active flow in the middle pane.
You can link the nodes together by dragging a wire between them.
A collection of linked nodes is called a flow.
Note: All flows in the workspace share the same node.js event loop.
Renaming, Deleting and Disabling Flows
A flow called Flow1 is pretty meaningless and so you should rename it to something more meaningful.
You can access the flow properties from the settings tab.
You need to select the flow in the workspace and then. to open the flow go to the menu (top right) and select flows> rename flow, delete, add.
If you select rename then a window opens that displays the flow properties .
You can rename the flow, and there is also a toggle to enable/disable it, and also a button to delete it.
There is also a delete button to delete the flow on the top left.
Note: enable button moved to bottom right in version 1.0
You need then to redeploy for the setting to take effect.
You can also access this setting by double clicking on the flow name tab:
You should notice the icon in the flow tab that indicates that the flow is disabled.
You can also change the order of the flows in the workspace by clicking on the flow tab and dragging it left or right.
Flow Files -Storage and Backup
Flows that you create are stored by default in a file in the .node-red directory of your home folder in a file called flows_servername.json.
The file is created when you run node-red for the first time, and is loaded each time that you run node-red.
EG. for my raspberry pi the file is flows_raspberrypi.json.
The file will contain all of the flows in the workspace.
However it is not the only file that is created. You will also see these files.
flows_raspberrypi.json.backup – This is a backup of the flows_raspberrypi.json file, and functions like a word backup.
When you do a deploy the old flows_raspberrypi.json file is moved to the backup file and the flows_raspberrypi.json is overwritten.
flows_raspberrypi_cred.json. – This file contains login data used by some nodes. If it is not present the flows will still work, but you will need to add the information back in to any nodes that need it.
flows_raspberrypi_cred.json.backup – Backup of flows_raspberrypi_cred.json and functions the same way as the other backup.
It is a good idea to backup your flows files on a regular basis. The automatic backup should only be considered a temporary one.
To do a complete backup then make a copy of the four files mentioned above:
Note: you will need to change the names to match your flows files.
Moving Your Flows to Another Machine
You can copy all of the flows by copying the flows_newmachinebane.json. file.
To use them on another machine change the file name to flows_newmachinebane.json.
The only file you really need is the flows_raspberrypi.json file however you should also copy the flows_raspberrypi_cred.json file.
See this github page for other important files and folders.
Creating Additional and Multiple Flow Files
You can created additional flow files for storing different workspaces.
To use another flows file you can create a new settings file and edit it.
As an example if I wanted to create a separate flows file to store client flows I would :
- copy the old settings file to a new one called client_settings.js
- Edit the settings file to point to the new flows file and remove the two forward slashes.
// flowFile: clientflows.json’,
- Start node-red using
node-red -s client_settings.js
You could also use the new flows file without creating a new settings file by using the command option which is my preferred option.
Notice you don’t need a switch. See Local Installs and managing node-red projects for more details.
=====> Deploying Node-red flows
Related Tutorials and Resources: