-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples Boolean Voting
mchristegh edited this page Jul 15, 2026
·
1 revision
Three door contacts reporting the strings open / closed, mapped
through custom True/False value lists, with a Majority open
trigger rule. Shows the vote fraction, the exact-split latch edge,
minority reports, and coercion rejection.
Import: Import → Examples → node-red-contrib-sensor-consensus → 03-boolean-voting.
Demonstrates: Type Modes (boolean coercion, custom lists) and Trigger and Release (vote rules), plus minority reports from Sources Freshness and Quorum.
-
Press
door1 open. One of one open is a majority — Trigger fires immediately. The denominator is the fresh source count, so don't be surprised that a single sensor can satisfy Majority. -
Press
door2 closed. The fraction is exactly 0.5, and Majority is ≥ 0.5 — the latch holds. No minority report either: at an exact split there is no consensus for anyone to disagree with. -
Press
door3 closed. One of three: Release fires, and output 4 carries aminorityreportnaming["door1"]— the sensor now disagreeing with the closed consensus. -
Press
door3 closedagain. No new report — reports fire when the disagreeing set changes, so a stuck sensor produces one report, not a stream. -
Press
door1 closed. The disagreement resolves: one finalminorityreportwith an empty set. -
Press
door1 sends 'true'. Rejected — areadingwithignored: trueandrejectedValue: "true"on output 4. Custom lists replace the defaults, so onlyopen/closedcoerce here.
-
msg.aggregatein boolean mode is the fraction of fresh sources true (0.0–1.0), and the node status renders it as counts, e.g.2T/1F of 3. - For flap suppression, set the Release Rule looser than the trigger (trigger on All, release below Majority) — the boolean form of hysteresis. Try it: with that configuration, one flaky contact can no longer toggle your automation.
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