Node-Red Example Flows

The idea of this page is to present simple flows or sub flows that solve a particular problem, and that can be used as part of larger projects.

If you have any suggestions then I would be glad to hear them just use the comment form at the bottom of the page.


Set Text Colour Of Text Dashboard Widget

The goal here is to change the text colour in a dashboard text widget but can also be applied to other widgets.

The flow consists of an inject node that send a simple text string and a change node to set payload properties for the colours.

set-colored text
The change node is shown below


The work is done the text node where HTML is used to change the font colour which is passed into the node as variables from the change node.

set-colored text-2



Splitting a Message Payload

In this simple project we will look at splitting a simple message payload, and then display the data in a text box and on gauges on a dashboard.

The payload consists of a simple string containing temperature and humidity readings separated by a ampersand (&).


To split it we use the split method to split the string into an array.

The array will look like this [26.8,1024].

Next there are two main approaches to dealing with the data:

  • Place data in an Object
  • Assign data directly to message properties

Placing data in an Object

We place the data into a JavaScript object and assign to the payload before returning. The code is shown below.

var data=msg.payload;
var temp=data.split("&");
var out={};
return msg;

The output would look like this.


To display in a text box we change the value format form msg.payload to msg.payload.humidity as shown below.


To display on a gauge we need to insert change nodes to change as shown below:


Assign data directly to message properties

The second approach is simpler and we use a message property for humidity and temperature and now our code looks like this :

var data=msg.payload;
var temp=data.split("&");
return msg;

To display it in a text box set the value format to msg.humidity instead of msg.payload.


However if you want to display it on a gauge then the value must be in the msg.payload field.

To do this we can use change nodes set as follows:


Both Approaches use the same nodes but they are configured differently. The flow look like this:


The dashboard like this:


The flows for both approaches are available to download below:


Simple Keypad for Node-Red Flows



Display last x Messages

Will display the last x messages. x is 10 by default and can be changed in the code.

Flow Diagram




Click to rate this post!
[Total: 2 Average: 5]


  1. Hello Mr.steve I am currently doing my college project I have an deployment error unauthorized due to invalid credentials.Please help to sort out.

  2. Hello Mr. Your blog is good. So i have many question about MQTT. because now i’m making a exam project about mqtt. Could I get have your contact email ?

Leave a Reply

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