Skip to content

How Device Sentinel Learns

TheThinkingHome edited this page Jul 17, 2026 · 17 revisions

How Device Sentinel Learns

The feature underneath everything: each home's devices are learned individually. No fixed timeout exists anywhere in Device Sentinel, because no fixed timeout can be right for both a motion sensor that speaks every 30 seconds and a water meter that speaks twice a day.

Watching

Device Sentinel listens passively to Home Assistant's event bus. Every time any entity of a device reports, that device's clock is stamped. Statistics are kept per device, not per entity: any entity's activity proves the device alive.

Service entries, cloud connections, and other devices with no hardware behind them are classified out automatically and never watched. That is the Service Devices Ignored count on the device page.

Learning the rhythm

For each device, each day, Device Sentinel records the longest quiet gap: the worst silence that still turned out to be normal. Those daily maxima build a rolling two-week picture.

The device's rhythm is the trimmed maximum of that window: the single worst day is set aside as a suspected anomaly, and the rhythm is the worst of what remains. One bad day, a Zigbee hiccup or an hour of WiFi trouble, moves nothing. A spike that repeats survives the trim and correctly widens the rhythm, because a device that genuinely got slower should be learned as slower.

Only completed gaps are learned. A device that goes silent and stays silent never finishes its gap, so a freeze can never teach the system that freezing is normal.

Arming

A device is judged for freeze only after it has enough learned days to have a trustworthy rhythm (the Devices Learned count). Before that, it is judged only for going unavailable, which needs no rhythm. Each device arms itself individually; there is no global learning mode, and a device added a year from now starts learning the day it arrives without anything being switched.

Devices with no natural heartbeat, buttons and remotes that speak only when used, never establish a rhythm and are never judged frozen. This is by design and is why Devices Learned is not expected to reach Devices Watched.

Staying honest

Restarts, integration reloads, and Zigbee bridge reconnects create bursts of stale-looking activity. Device Sentinel recognizes these storms and its own startup window and discounts them, so a reconnect never rewinds a device's clock and never teaches a false rhythm.

Everything survives restarts. The learned statistics, every device's clock, and any flag in progress are stored on disk: a device twenty hours into a freeze is still twenty hours frozen after a reboot.

Clone this wiki locally