Node-RED guide series

Node-RED, the
"rbe" node

"RBE" stands for "Report by Exception".
This node will will only pass changes to its output,.

Suppose that you are sending on/off instructions to a motor or other actuator. The motor will turn on after it receives an "on" instruction, and any subsequent "on" instructions will have no effect.

In a Node-RED flow, this is case where you can use an "rbe" node to only propagate changes in the content of a message. With the "rbe" node, a message that is equal to the previous message will not be propagated, while a different message will.

With the motor example (which actually comes from the Terrarium controller project), the "rbe" flow will block new "on" messages if the last message was also "on", but will propagate an "off" message.

You will find the "rbe" node in the functions group of the left toolbar.

The "rbe" node.

Setup the "rbe" node

To explain how to use the "rbe" node, I have created this simple flow:

This flow contains an "rbe" node.

This flow is triggered by the two "inject" nodes on the left. The "debug" node on the right will simply print out values "1" or "2", depending on which button was clicked.

Here's the interesting part: The message that arrives to the "debug" node is controlled by an "rbe" node. Only changes in the message payload will go through.

So, If you click the inject node named "1" multiple times, the output will show "1" only once.

You will get the same behavior by pressing inject node "2" multiple times.

However, if you alternate your clicks between "1" and "2", all of the messages will be printed in the debug pane.

Here is how I have setup the "rbe" node

The "rbe" node setup.

I have set the mode to "block unless value changes", and the value that is evaluated to "msg.payload".

That's all there is to it.

To test it, deploy the flow and click on the two "inject" node buttons. Here is an example output:

Notice that the messages alternate between "1" and "2" even though I was frantically clicking on the same button multiple times.

The "rbe" node offers several mode options as you can see in the screenshot below. You can qualify for the kind of change that want to block or allow message propagation.

"rbe" node mode options.

Learn Node-RED and how to use it with the ESP32

This course will guide you through the construction of an automated control system. The deliverable is a Terrarium controller.

Along the way, you will learn a great deal about useful technologies such as the Node Red programming environment and MQTT.

Browse this article

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community. One email per week, no spam; unsubscribe at any time

Image
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}