Homey Community Forum

BLE advertisement cache


I am making a weather sensor integration app for Homey. Sensors use Bluetooth Low Energy (BLE) to communicate with Homey.

The problem is that Homey.ManagerBLE.discover() and Homey.ManagerBLE.find() both return cached advertisements and do not refresh them in a reasonable time (several minutes at max).

It is crucial for the advertisements to be refreshed every time Homey discovers them from the sensors in my app, as the sensor BLE advertisement contains data about current sensor state (calibrating, updating firmware, disabled integration, etc.) and availability to be connected to.

Restarting the app seems to be one way to clear cached advertisements and after that the next discover returns fresh advertisements, but is not an appropriate solution to the problem.

So my question is:

  • Is there a way to clear app cache or get fresh advertisements from BLE device?

Thank you in advance.

I don’t think there are any API’s that you can use to clear the cache, so you’d have to ask Athom (through the support form) if there are any “hidden” ways to clear the cache (or, if there aren’t, explain your use case and ask them to provide for methods to clear it, or to simply not cache at all if so requested).

Maybe @Koktail can tell you something about it