In this article
When an ESPHome binary sensor remains ON, first identify where its state is being decided:
- A numeric reading may not have crossed the boundary required to change the underlying state.
- An OFF value may have reached a binary-sensor filter that is waiting before publishing it.
- A BLE device may not have been undetected long enough for ESPHome to publish it as absent.
These are the distinct roles of analog_threshold hysteresis, the delayed_off filter, and the ble_presence timeout. Hysteresis changes the boundary for a state transition; the other two use time, but start counting from different events.
This comparison is based only on the cited ESPHome documentation. It does not evaluate combined configurations, timing precision, real-world reliability, sensor noise, BLE accuracy or range, hardware requirements, recommended settings, or delivery to Home Assistant.
Three OFF-state decision points
| Control | Component owner | Input | Documented condition | Result |
|---|---|---|---|---|
| Analog hysteresis | analog_threshold binary sensor |
Numeric sensor reading | While high, the reading crosses the configured lower threshold | Source-derived state changes from high to low |
delayed_off |
Binary-sensor filter pipeline | OFF value received by the filter | Input remains OFF for the configured delay | OFF is published; ON during the wait cancels the pending OFF |
| BLE timeout | ble_presence binary sensor |
Time since the tracked device was last detected | Configured timeout elapses without another detection | Device is published as not present |
The important distinction is what initiates each decision. Analog hysteresis evaluates a numeric reading. delayed_off receives an OFF value and postpones publication. BLE timeout measures elapsed time from the most recent detection.
1. Analog hysteresis determines when the state changes
The analog_threshold platform converts readings from a numeric sensor into boolean values by comparing them with a threshold. The ESPHome documentation provides this example using a motor-current sensor: ESPHome Analog Threshold Binary Sensor

binary_sensor:
- platform: analog_threshold
name: "Garage Door Opening"
sensor_id: motor_current_sensor
threshold: 0.5
A shorthand numeric threshold uses the same value for both the upper and lower thresholds. To use hysteresis, threshold accepts a mapping that defines separate upper and lower values. The upper threshold governs the transition from low to high, while the lower threshold governs the transition from high to low. ESPHome Analog Threshold Binary Sensor
That makes the current state relevant when a reading falls between the two thresholds. If the binary sensor is already high, it remains high until the reading meets the documented lower-threshold condition. If it is low, the upper threshold controls the transition to high.
This is not a timer applied after ESPHome has already produced an OFF value. The lower threshold is part of deciding whether the source-derived state should become low at all.
The same component also has documented behavior for unavailable input. If the source sensor is uninitialized when the component is created, the initial binary state is false. Later invalid source updates are ignored, leaving the binary sensor in its previous state. ESPHome Analog Threshold Binary Sensor
That edge case is separate from hysteresis. A retained ON state may mean either that a valid reading has not crossed the lower threshold or that an invalid update was ignored.
2. delayed_off postpones publication of OFF
delayed_off belongs to ESPHome’s general binary-sensor filter system. Binary-sensor filters form a pipeline and run in configuration order, so the position of each filter matters. ESPHome Binary Sensor Component
The base documentation includes this sequence:
binary_sensor:
- platform: ...
filters:
- invert:
- delayed_on: 100ms
- delayed_off: 100ms
Because invert appears first, the delay filters process the value produced after inversion. The documentation establishes this ordered pipeline behavior, but it does not document every possible interaction between delayed_off and individual sensor platforms.
When delayed_off receives OFF, it waits for the configured duration before publishing that state. If the input remains OFF for the entire period, OFF is published. If ON arrives during the wait, the pending OFF action is discarded. ESPHome Binary Sensor Component
The filter therefore begins with an OFF value that has already reached it. It does not determine whether an analog reading crossed a threshold. Instead, it requires the OFF input to persist for the configured period before allowing publication.
When diagnosing this behavior, inspect both the configured duration and the filters that precede delayed_off. An earlier filter can change the value that reaches it because processing follows configuration order.
3. BLE timeout measures from the last detection
The ble_presence platform tracks whether a Bluetooth Low Energy device is present. Its timeout option specifies the delay after the device was last detected before ESPHome publishes the not-present state. The documented default is five minutes. ESPHome Bluetooth Low Energy Device
The official page includes a 45-second timeout in its service-UUID example:
esp32_ble_tracker:
binary_sensor:
- platform: ble_presence
service_uuid: "11aa"
name: "ESP32 BLE Tracker Test Service 16 bit"
timeout: 45s
The reference event is the most recent detection. After ESPHome detects the tracked device, another detection prevents the configured absence interval from completing. If no further detection occurs and the timeout elapses, ESPHome publishes the device as not present. ESPHome Bluetooth Low Energy Device
This differs from delayed_off. That filter starts waiting when it receives OFF; BLE timeout is defined relative to when the device was last detected. The documentation does not establish how radio conditions, scan behavior, or timing precision affect that process in a particular installation.
How to identify the relevant control
Trace the input and the event that begins the OFF decision:
- For a numeric source, inspect
analog_threshold, including whetherupperandlowerare configured separately. - For a binary filter chain, inspect
delayed_off, its duration, and its position in the ordered pipeline. - For BLE presence, inspect
timeoutand reason from the device’s last detection.
The mechanisms may all explain a sensor that has not published OFF, but they answer different questions: Has a numeric boundary been crossed? Has OFF persisted through a filter delay? Or has enough time passed since the last BLE detection?
No comments yet