Repository navigation
Examples: Cooldown
The full cooldown lifecycle at test scale: trigger on 2 events within 30 seconds, then a 20-second cooldown during which further events bounce off — visibly. Feature reference: Cooldown.
Import → Examples → node-red-contrib-timer-threshold → cooldown, then Deploy.
Three inject buttons — Sensor event, Stop, and Query — into
a Timer Threshold node (2 in 30s, 20s cooldown — Count Limit 2,
Window 30 Seconds, Fixed mode, Cooldown 20 Seconds, Status Reporting
Every Second), with a debug on each output.
1. Trigger into cooldown. Click Sensor event twice. Output 1
fires the Trigger; output 3 shows the duplicate, immediately followed
by cooldownstarted (source: "internal"). The label switches to
Cooldown: 00:00:19, counting down.
2. Bounce messages off it. Keep clicking Sensor event during
the cooldown. Output 1 stays completely silent — that's its guarantee.
Every click appears on output 3 as counted with ignored: true, and
msg.ignoredCount climbs with each one. The node is telling you, per
message: this was a count attempt, and it did not take effect.
3. Query mid-cooldown. Click Query: timerState: "cooldown",
with the remaining time in both cooldownRemaining and
windowRemaining, and the ignoredCount from step 2.
4. Let it end. Wait out the 20 seconds. Output 3 emits
cooldownended — and output 1 emits nothing: the Trigger was
already reported once, at step 1, and the cooldown ending merely
reopens the gate. Click Sensor event twice and a fresh cycle
triggers normally (ignoredCount back at 0).
5. Cut one short. Trigger again (two clicks), then click Stop
mid-cooldown. Output 3 shows a genuine stopped, the label returns to
Ready, and the very next clicks count normally. stop is the only
command that does this — try the experiment of editing the flow to send
reset or enable instead and watch them bounce (ignored: true for
reset; enable toggles the flag but the cooldown holds). The rationale
for that asymmetry is on Cooldown.
- Change Count Limit to
1and Cooldown to1Minute: the node is now a pure rate limiter — first event passes, then nothing for a minute, no matter how fast you click. See the pattern note on Cooldown. - Wire a
switchnode on output 3 matchingtimerEvent == "counted"andignored == trueinto a counter or notification — "the condition kept breaching N times during the cooldown" is often as interesting as the original alert.
Getting Started
Reference
Features
Examples
Test Script Coverage
Support