Node-RED guide series
Node-RED, the "trigger" node
With the "trigger" node, you can repeat a message at an arbitrary period.

With the "trigger" node, you can repeat a message at an arbitrary period.
You will find the "trigger" node in the functions group of the left toolbar.

The "trigger" node.
Setup the "trigger" node
To explain how to use the "trigger" node, I have created this simple flow:

This flow contains a "trigger" node.
When I click on the button of the "inject" node named "Start", the "trigger" node will send the string "tap..." to the "debug" node, and will continue to do so every 1 second.
When I click on the button of the "inject" node named "Stop", the trigger node will reset and wait for the next message from "Start".
Here is the configuration of the Start node:

The Start "inject" node. Just sends out a text message.
This is the configuration of the "trigger" node:

The configuration of the "trigger" node.
Notice that there is an option to reset the trigger by sending a msg.reset (the content of the reset attribute is not important), or by setting a specific value in the msg.payload attribute.
In this example flow, I use the msg.reset method. Here is the configuration of the Stop node:

The configuration of the Stop node.
In the Stop node configuration, notice that I have created the "rest" attribute of the msg object, and set it to contain a timestamp. It does not matter what you store in the reset attribute. It can be a number, a string, a JSON object etc. The actual content is ignored by the trigger node; what matter is that the reset attribute exists.
In the terrarium project, among other things, I use a trigger node to get a reading from the DHT22 sensor every 10 seconds.
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.
Jump to another article
1. Introduction to Node-RED
2. Install Node-RED on the Raspberry Pi
3. Configuration
4. Nodes
5. Flows
6. Messages and Variables
7. The "complete" node
8. The "catch" node
9. The "link out" and "link in" nodes
10. The "switch" node
11. The "range" node
12. The "delay" node
13. The "trigger" node
14. The "RBE" (Report by Exception) node