Help understand esp32_ble_tracker and scan_interval

I am attempting to use esp32_ble_tracke to track the presence of some BLE devices.

I think that scan_interval dictates how often the scan is performed, but it’s not clear how long it the scan lasts. Is the scanning constant, for the duration of the scan_interval ?

I’ve noticed with a shorter interval, my ble devices often switch between on and off. If I increase it, they are more stable, but presumably it takes longer to confirm a device is “on”


Not quite, the docs say this

scan_interval ( Optional , Time): The length of each scan. If a device is not found within this time window, it will be marked as not present. Defaults to 300s.

Ah yes. But its not a rolling window. If you look at the logs it prints “scanning for BLE devices” once per scan interval. Which implies if a device is seen 5 seconds into a scan, it could take 235 seconds until it’s reported as offline?

I have to agree, it is not particularly easy to understand.

I’m revisiting this now 1.14.0 has been released and scan_interval has been depreciated. It gives the reason “It never had an effect” - this conflicts with my own observations / assumptions where a device was marked as away if it hadn’t been seen for the duration of the scan interval.

So, on 1.14.0 when does the esp32_ble_tracker mark a device as away?