-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples Basic Numeric Averaging
mchristegh edited this page Jul 15, 2026
·
1 revision
Three humidity sensors averaged into one trusted value, triggering at mean ≥ 60% and releasing below 55% (hysteresis).
Import: in the editor, Import → Examples → node-red-contrib-sensor-consensus → 01-basic-numeric-averaging. The flow contains inject buttons for the sensors, the consensus node, and one debug node per output so the routing guarantees are visible in the Debug sidebar.
Demonstrates: Type Modes (numeric, mean) and Trigger and Release (Above direction, hysteresis, latching).
-
Press
hum1 = 55,hum2 = 58,hum3 = 52. Each press emits asourceaddedevent on output 4 (a first reading announces itself — see Events), and the node status settles at a green55 (3/3 fresh). Below the trigger: outputs 1 and 2 stay silent. -
Press
hum2 = 75. The mean becomes 60.67 — Trigger fires on output 1, with a duplicate copy on output 4. Note the envelope:consensusState: "triggered",msg.aggregate: 60.67, and the full per-source breakdown inmsg.sources. -
Press
hum2 = 75again. Nothing on output 1 — the latch fires once per transition. The reading itself is also suppressed on output 4 because the aggregate didn't change (Emit aggregate on change only is checked — see Output Messages). -
Press
hum2 = 45. Mean 50.67, below the release value 55: Release fires on output 2 withreleaseReason: "threshold". -
Press
queryat any time for a snapshot on output 3 — state, aggregate, quorum, and every source's value and last-seen time.
- Values between 55 and 60 do nothing to a released latch and nothing to a triggered one — that dead band is the hysteresis, and it's why one noisy sensor near the threshold doesn't toggle your automation.
- Every message on every output carries the same envelope, so a
downstream
switchonmsg.consensusEventcan slice the Events stream however you like.
Next: add trust to this exact setup in Examples Staleness and Quorum.
Getting Started
Reference
Features
Examples
- Examples Basic Numeric Averaging
- Examples Staleness and Quorum
- Examples Boolean Voting
- Examples Runtime Commands
Test Script Coverage
- Overview
- Test Suite 1 — Output routing & envelope shape
- Test Suite 2 — Aggregation functions
- Test Suite 3 — Boolean mode
- Test Suite 4 — Commands
- Test Suite 5 — Threshold set-commands & release-follows-trigger
- Test Suite 6 — Status labels
- Test Suite 7 — Staleness, quorum policies, heartbeat
- Test Suite 8 — Persistence
Support