Skip to content

Heartbeat

mchristegh edited this page Jul 10, 2026 · 2 revisions

An optional fixed-interval tick that makes the node emit a full state snapshot on output 2 (Query) at a regular cadence while a cycle is active — the node reporting in without being asked.

Configuration

Heartbeat Interval + Heartbeat Units in the edit dialog (see Configuration). 0 (the default) disables the feature.

What a tick is

Each tick produces a normal Query-output message — identical in shape to the response to a query command, distinguishable only by msg.source: "internal" (a requested query is "external"). The snapshot carries the full envelope: current count, effective limit, windowRemaining, state, the disabled flag, ignored-message tracking — everything on Output Messages. Its payload base is the last counted message, per the standard clone lineage.

Lifecycle

  • Starts the moment a counting cycle begins — the first counted message.
  • Keeps ticking through counting and straight through Cooldown.
  • Stops whenever the node returns to idle: a window expiry (fixed close or sliding decay to zero), a stop, a reset, a cooldown ending — or a Trigger with no cooldown configured, which lands on idle directly.
  • No ticks while idle. An idle node is silent; if you need a liveness signal even when nothing is counting, an inject node sending query on an interval does exactly that.

The schedule is fixed

Once started, the heartbeat ticks on its own independent, fixed wall-clock schedule. It is not affected by:

  • setwindow or setcountlimit changing the cycle underneath it
  • Candidates being blocked by cooldown or the disabled flag
  • Sliding-mode decay changing the count

This makes the tick stream a reliable metronome: a monitoring flow can alarm on a missing tick as evidence that Node-RED (or the flow) is unhealthy, independent of what the node itself is doing.

One exception: after a Persistence restore, the heartbeat restarts fresh from the restore moment rather than resuming the original schedule — the first post-restore tick lands one full interval after startup.

Why you'd use it

  • Watching sliding decay. In sliding mode the count can drop with no message and no event (Window Modes). A heartbeat is the natural way to observe the decaying count without polling: each tick reports the current count and when it will next change (windowRemaining).
  • Watchdogging long windows. A 6-hour window with a 15-minute heartbeat gives external monitoring continuous evidence the cycle is alive and progressing.
  • Live cooldown display. Ticks during cooldown carry cooldownRemaining — wire output 2 to a dashboard for a countdown.

Heartbeat vs. Status Reporting

The two look similar and are entirely different. Status Reporting (Configuration) drives only the text label under the node on the canvas and never produces a message. Heartbeat produces real messages on output 2 and never touches the label. Enable either, both, or neither independently.

Clone this wiki locally