-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
A threshold-counting node for Node-RED that triggers an output after a configured number of messages arrive within a configured time window. It exists to suppress false positives from sensor noise: rather than acting on a single threshold breach, it requires the breach to repeat N times within Y time before firing.
The canonical example: a humidity sensor fluctuates around 55%. Wire it through this node configured as "3 exceedances within 15 minutes" and a single brief spike never triggers — while a genuinely persistent condition still alerts quickly, because the Trigger fires the instant the count is met, never waiting for the window to close.
| # | Output | Fires on |
|---|---|---|
| 1 | Trigger | The count reaching the limit within the window. Nothing else. |
| 2 | Query | An incoming query message, or a Heartbeat tick. Nothing else. |
| 3 | Events | Every other event, plus a duplicate copy of every Trigger. |
Output 1 never carries a blocked or redundant message — anything that
didn't truly happen appears only on output 3, tagged msg.ignored: true.
The full event vocabulary is on the Events page; the message
envelope every output carries is on Output Messages.
The node has two window modes, and they behave very differently:
- Fixed — one shared clock, anchored to the first message of a cycle. The window expires all at once.
- Sliding — each message ages out individually, so the count can decay stepwise on its own as messages fall out of the window.
If the node ever seems to "lose count" mysteriously, you are almost certainly in sliding mode and watching correct behavior. Read Window Modes before anything else.
Like its sibling timer-events, this node treats observability as a
design principle. Every counted message, blocked message, expiry, and
cooldown transition is a tagged event with a consistent envelope
(timerEvent, timerState, count, ignored, source, and more)
describing the node's full state at that moment. A command that didn't
take effect still produces an event — labeled with what was attempted
and tagged ignored: true.
- New here: Installation, then the first example — Examples: Basic Usage.
- Configuring the node: Configuration for every field, Window Modes for the central choice.
- Building flows against it: Input Messages (commands), Output Messages (envelope), Events (taxonomy), States (lifecycle).
- Feature deep-dives: Cooldown, Heartbeat, Persistence.
- Something looks wrong: Troubleshooting — several behaviors that look like bugs are deliberate, documented design decisions.
This node is the sibling of
node-red-contrib-timer-events,
a countdown timer. The two share the same event envelope property names,
command conventions, and output philosophy — downstream function and
switch nodes can process both nodes' output with the same code. Where
timer-events debounces by ignoring repeat messages during a run,
timer-threshold requires accumulation of repeat messages within a
window. They compose well: see the wiki examples for both.
Licensed under the Apache License 2.0. Copyright (C) 2026 mchristegh.
Getting Started
Reference
Features
Examples
Test Script Coverage
Support