Skip to content

Examples Runtime Commands

mchristegh edited this page Jul 15, 2026 · 1 revision

Every aspect of the node driven by message at runtime: the disable/enable suppression cycle, moving thresholds live (including a deliberate rejection), changing the staleness window, removing a source, and reset.

Import: Import → Examples → node-red-contrib-sensor-consensus → 04-runtime-commands.

Demonstrates: Input Messages (the full command set) and Trigger and Release (release-follows-trigger and the symmetric guards).

Walkthrough

  1. Press sensorA = 58 and sensorB = 59. Mean 58.5 — untriggered baseline.
  2. Press disable, then sensorA = 66. The mean is now 62.5, which warrants a Trigger — but the node is disabled, so output 1 stays silent and output 4 shows triggered with ignored: true. Disable freezes decisions, not data: the reading was accepted and the aggregate moved.
  3. Press enable. The suppressed transition fires genuinely, right now, on outputs 1 + 4 — the enable command re-evaluates immediately.
  4. Press settrigger 70. With no distinct release configured at runtime, the release follows the trigger — and because set-commands re-evaluate in place, the latched node releases on the spot (62.5 < 70). One command, observable consequence.
  5. Press setrelease 65, then settrigger 50. The second command is rejected (triggerset with ignored: true, triggerSet: 50): 50 sits on the wrong side of the now-distinct release 65. Thresholds guard each other symmetrically — see Trigger and Release for the pair-move ordering that makes big moves possible.
  6. Press setstale 30s. Sources now expire after 30 seconds of silence — wait it out and watch sourcestale arrive on output 4.
  7. Press remove sensorA to drop a decommissioned sensor (the node recomputes and re-evaluates), and reset to clear everything back to waiting. Note that the settrigger override survives the reset — reset clears data, not configuration.
  8. Press query at any point to see the current state of all of the above in one snapshot on output 3.

Things worth noticing

  • No command failure in this flow is silent, and none appears in the Debug sidebar as a warning — rejections are ignored: true events on output 4 with the attempted value attached, so your flows can react to them like anything else.
  • Commands are case-insensitive; the disable inject actually sends DISABLE in the original flow to prove it.

Clone this wiki locally