LocalFirst Home
< Back to all guides
Published by Renan

ESPHome sensor silence: detect a failed measurement while the node stays online

Separate ESPHome connection status from sensor health. Use timeouts carefully, avoid heartbeat traps, and test missing measurements before relying on alerts.

ESPHome sensor silence: detect a failed measurement while the node stays online

Separate ESPHome connection status from sensor health. Use timeouts carefully, avoid heartbeat traps, and test missing measurements before relying on alerts.

Your ESPHome node answers the network, yet the temperature has not been measured for ten minutes. Restarting the dashboard does not repair the probe. Neither does showing a green connection icon beside the old number.

Treat the board’s connection, the production of measurements and the validity of those measurements as separate signals. This article focuses on the second problem: detecting silence in a sensor’s update path without confusing a repeated cached value with a new observation.

The useful result is a health signal that fails when real measurements stop and recovers when valid measurements return. A board announcing that it is still online is lovely. The probe was the part we wanted to hear from.

Decide what counts as a successful measurement

For an illustrative workshop sensor, suppose a real measurement should arrive every 30 seconds. Start by recording what the driver does when the probe fails: stop publishing, publish an invalid value or repeat the last value. Those behaviors require different checks. Do not assume unplugging a sensor exercises every failure mode.

A quiet temperature is not necessarily a dead sensor. A stable room may produce the same numeric value all day. Use a successful-update event or an explicit measurement-age signal rather than a rule that declares failure whenever the number does not change.

The ESPHome status binary sensor reports node connection state through MQTT or the native API. That is useful context, but it does not certify a physical probe. Keep it alongside the measurement-health information instead of using it to replace that information.

Place the timeout where it can see real updates

The numeric sensor timeout filter emits a configured value, normally NaN, when updates stop after the first value. It is particularly relevant to interrupted measurement paths. This fragment belongs inside an existing numeric sensor definition:

filters:
  - timeout: 90s

Here 90 seconds is an example for a nominal 30-second source, not a universal safe setting. Check the actual interval, startup behavior and tolerated missed reports. The fragment does not define your board, wiring or sensor platform, and it must be merged with existing filters rather than added as a second duplicate YAML key.

A timeout cannot detect every failed probe. A driver repeatedly publishing a plausible cached number continues feeding the filter. A driver publishing invalid values is also different from a driver producing no updates. Inspect raw driver events and logs before deciding what the timeout is meant to catch.

There is also a startup gap: the documented timeout behavior begins after a first value. A sensor that never produced one needs an explicit startup expectation or a consumer-side check. Do not consider it healthy merely because the timeout has not emitted anything yet.

A probe feeds a driver, then freshness checks, then the consumer; node connection status is a separate signal
Observe real measurement production before filters that suppress or synthesize updates. Values shown are illustrative, not test results. Open full-size image

Heartbeat can preserve a display while hiding silence

The sensor filter reference describes heartbeat as periodically republishing the last known value. That can be useful for downstream consumers expecting periodic output. It is not a request for a new physical conversion.

If a heartbeat sits before a timeout, its synthetic updates can keep feeding the timeout even after the source stops. Conversely, a filter that suppresses unchanged readings can make a downstream timeout appear to fail during a perfectly stable measurement period. Filter order is part of the diagnostic design.

For a first health test, simplify the chain. Observe the measurement stream before adding throttling or heartbeat. If the final application needs smoothing and periodic publication, preserve a separate health signal tied to successful raw measurements. Document what that signal means, especially if it passes through another bridge.

The same distinction applies to retained MQTT readings: receiving a value now does not establish that it was measured now. Repeating it locally does not make it newer either.

Give the consumer a reason it can act on

Represent missing or invalid data explicitly. Do not convert every failure to zero: zero degrees may be a valid temperature, and a false zero can trigger the wrong automation. Verify how the invalid value appears in your actual Home Assistant entity and how the automation treats it.

A practical health view distinguishes these cases:

Node connectionMeasurement pathInterpretation to investigate
ConnectedValid updates arrivingNormal reporting path
ConnectedNo new measurementsDriver, bus, probe or filter issue
DisconnectedLast value still displayedNode power, network or consumer connection
ConnectedInvalid measurementsExplicit measurement error, not silence
Not yet establishedNo first measurementStartup remains unverified

For a noncritical alert, notify that the measurement is missing and include the affected sensor identity. Avoid claiming that a freezer is warm when the only evidence is an unavailable probe. Rate-limit repeated alerts and provide a clear recovery notification when valid readings resume.

Critical equipment still needs appropriate local protection. A freshness alarm on a household dashboard does not replace a protective thermostat or other independent safeguard.

Record the three transitions that matter

Use the nominal 30-second source and 90-second timeout only as a bench example. Write down the last observed valid raw update, the unavailable indication and the first valid recovery update. Measure the timeout from the relevant update, not from when you happened to open the dashboard.

For the unchanged-reading trial, confirm that successful driver publications continue even when the number stays constant. For the silence trial, confirm that those publications actually stop while the node remains connected. If you only stop downstream publication, you have tested a different boundary.

Finally, start the node with no usable probe result. Record which startup check makes that condition visible; the filter’s post-first-value timeout is not evidence that startup succeeded. Keep invalid-value handling explicit too, because a stream of invalid updates is not the same failure as a silent stream.

Rehearse faults without changing production wiring live

Use a spare node or a low-voltage bench setup. Preserve the working YAML and identify a recovery route before changing firmware. Power down before making wiring changes unless the hardware documentation explicitly supports the operation.

First observe normal reporting, including a period with an unchanged physical reading. Then simulate a source that stops updating while the node remains connected. Check when the timeout appears, what state the consumer shows and whether the intended notification runs.

Test node power loss separately. Finally, restart the consumer and the node independently, including a startup where no valid measurement becomes available. These are proposed checks, not tests claimed to have been run on your hardware.

Do not add automatic reboot loops before understanding the fault. Rebooting may temporarily hide a bus problem and erase useful evidence. Keep the reporting interval, filter order, startup expectation and recovery behavior with the configuration so the next change does not silently break the health signal.

Keep reading

Related guides

View all guides