-
-
Notifications
You must be signed in to change notification settings - Fork 0
Examples Staleness and Quorum
Two temperature sensors with a 15-second staleness window, a quorum of 2 fresh sources, and both sensors declared as Expected Sources. This is the failure mode plain averaging nodes hide: a dead sensor's last value skewing the result forever.
Import: Import → Examples → node-red-contrib-sensor-consensus → 02-staleness-and-quorum.
Demonstrates: Sources Freshness and Quorum (staleness, quorum, expected sources, the Hold policy) and the envelope-ordering nuance in Output Messages.
-
Press
querybefore anything else. State iswaiting, andmsg.sourcesalready liststemp1andtemp2withseen: false— expected sources are visible from deploy, so a sensor that never comes up is a fact you can see, not an absence you'd have to remember. -
Press
temp1 = 70andtemp2 = 70. The second reading satisfies quorum (quorumregainedon output 4 — note it still reportswaiting; envelopes reflect the instant of dispatch) and Trigger fires (mean 70 ≥ 60). -
Now wait 15 seconds without pressing anything. Output 4 shows
sourcestalefor each sensor as its own clock expires it — the first one still showsquorum: true, with thequorumlostthat follows as the correction. -
Press
query.consensusStateis stilltriggeredwithquorum: false: the Hold policy keeps the last consensus when trust is lost, and the node status shows the held latch:Triggered | No quorum (0/2) | --. -
Press both sensors again.
sourcerecoveredfor each,quorumregained, and — importantly — no duplicate Trigger: the latch survived the outage.
Open the node, switch On Quorum Lost While Latched to Release,
redeploy, and repeat steps 2–3: this time quorum loss immediately
fires a genuine Release on output 2 with
releaseReason: "quorumlost". Hold suits a dehumidifier; Release
suits an alarm.
- The 15-second window is demo-short. Deployed for real, size it to a
few missed reporting intervals of your slowest sensor — and expect
sourcestalechatter on output 4 if you leave this demo deployed and idle. - Below quorum the aggregate is still computed and reported
(
msg.quorum: false) — only the decision is suspended.
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