Node-RED 2.2 is now available to install. If upgrading, please read the upgrade instructions.

The Change Log has the full list of changes in this release, but here are the highlights.



Highlights

Search History

The main search dialog now keeps a history of your searches. This makes it easy to repeatedly search for the same thing.

Remembering zoom/position

Under the View section of the main settings dialog, there are a pair of options to get the editor to remember the zoom level of the workspace, as well as the scroll position of individual tabs.

This is helpful if you prefer to have the workspace zoomed in - you don’t have to reset it every time you reload the editor.

Aligning nodes

With snap-to-grid enabled, nodes with hidden labels (for example, link nodes) can now be aligned on either their left or right edge. This will make it easier to get everything to line up in the workspace

Detaching nodes

You can now delete a node from the middle of a flow and have the wiring automatically repair itself in the background.

This is done by holding the Ctrl (or Cmd) key when you press delete.

You can also detach a node from the flow without deleting it:

We haven’t assigned a default shortcut for that, but you can assign one yourself in the Keyboard pane of the Settings dialog. The action is called core:detach-selected-nodes.

Selecting multiple wires

You can also select multiple wires by ctrl-clicking on them.

When you select multiple nodes, we also highlight any wires between them. This can make it easier to follow a flow once you have selected it.

Slicing wires

We’ve added the ability to remove wires by slicing through them. You do this by holding the ctrl (or cmd) key, then dragging the mouse with the right-hand button pressed:

Subflow Output labels

If you have set output labels for a subflow template (via the Appearance tab of its edit dialog), the editor will now display those labels whilst you are editing the subflow template.

Predefined Environment Variables

We have added a number of predefined Environment Variables that provide access to information about the node, group and flow at the point they are evaluated.

  • NR_NODE_ID - the ID of the node
  • NR_NODE_NAME - the Name of the node
  • NR_NODE_PATH - the Path of the node - this is a new concept that we’ll explain below.
  • NR_GROUP_ID - the ID of the containing group
  • NR_GROUP_NAME - the Name of the containing group
  • NR_FLOW_ID - the ID of the flow the node is on
  • NR_FLOW_NAME - the Name of the flow the node is on

The guide for using Environment Variables in your flow is available here.

For example, in a Function node, you can do:

const functionName = env.get("NR_NODE_NAME")
const flowName = env.get("NR_FLOW_NAME")
msg.payload = `I was sent by Function '${functionName}', on flow '${flowName}'`
return msg

Node Paths

This is a new internal property of Nodes we’ve added that helps identify where exactly any node is within the overall flows.

The following may sound a bit abstract, and it’s something most users can skip over. But it can be useful when creating your own subflow modules with custom logging messages inside.

If a NodeA is on Flow1, it will have a path of Flow1/NodeA.

That isn’t very interesting, but it gets more interesting when dealing with subflows and, in particular, nested subflows.

When we create an instance of a subflow, all of the nodes in the subflow are given randonly generated ids. If that node logs an error, you see the generated ID, not the ‘true’ id as appears in the editor. It gets harder when you have nested subflows because you need to be able to identify which instance of the node, in which instance of the subflow to go looking for.

The path property can solve that by providing the ids of the top-level flow and each subflow instance to identify exactly where the node is.

This property is exposed in the following ways:

  • For node authors, it is available as this._path on the node object.
  • Inside the Function node, it is exposed as node.path.
  • It is also available as the environment variable NR_NODE_PATH when evaluated by a node.

Node Updates

  • The JSON node will now attempt to parse Buffer objects if they contain a valid string
  • The TCP Client nodes support TLS connections
  • The WebSocket client node now lets you specify a sub-protocol to connect with

What’s next?

Next on the release plan is Node-RED 3.0, scheduled for the end of April.

This coincides with Node.js 12 reaching its end of life.

As ever, if there are any particular features you’re interested in, now is a great time to jump into the forum to share your feedback.