-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples: Basic Usage
Your first flow: count three events within a fixed 30-second window,
watch every output, then meet stop, reset, and query. Ten
minutes, no prior knowledge assumed.
Import → Examples → node-red-contrib-timer-threshold →
basic-usage, then Deploy. (The examples menu appears once the package
is installed; the same file also lives in the repository's examples/
folder if you prefer Import → Clipboard.)
Four inject buttons wired into one Timer Threshold node
(3 in 30s (fixed) — Count Limit 3, Window 30 Seconds, Fixed mode,
Status Reporting Every Second), and one debug node on each output. The
debug names tell you what to watch for.
1. Trigger it. Click Sensor event three times, briskly. In the debug sidebar:
- Clicks 1 and 2 each produce a
countedevent on output 3 — notemsg.countclimbing, and the status label under the node:Counting: 1/3 | Window: 00:00:28counting down. - Click 3 produces the Trigger on output 1 and a duplicate on
output 3 — the node never waits for the window's remaining time. Its
payload is
exceeded, cloned from the click that completed the count, and its envelope already shows the settled state (count: 0,timerState: "idle"). The label flashesTriggered, then returns toReady.
2. Let a window expire. Click Sensor event twice, then wait out
the 30 seconds. Output 3 emits windowexpired
(source: "internal") — the whole count reset at once, which is fixed
mode's signature. See Window Modes.
3. Stop vs. reset. Click Sensor event once, then Stop:
output 3 shows a genuine stopped and the label returns to Ready.
Do the same with Reset: same effect here — reset on output 3.
While counting the two are interchangeable; they only differ during a
cooldown, which this flow doesn't configure (see Examples: Cooldown
and Input Messages).
Now click Stop again while idle: output 3 shows stopped with
ignored: true — there was nothing to stop, and the node tells you so
instead of staying silent. That pattern — the attempted event, tagged —
is how every no-op surfaces. See Events.
4. Query. Click Sensor event once, then Query: output 2
delivers the full snapshot — count: 1, countLimit: 3,
timerState: "counting", windowRemaining ticking down. The query
changed nothing; click Sensor event twice more and the Trigger
still fires on schedule.
- Change Window Mode to Sliding in the edit dialog, redeploy, and repeat step 2 — then read Examples: Sliding Window for what just changed.
- Wire output 1 into a real action (a notification node): because the Trigger clones the completing message, whatever payload/topic your real sensor sends arrives at the action intact.
Getting Started
Reference
Features
Examples
Test Script Coverage
Support