Expose async_clear_advertisement_history in the bluetooth API#169191
Merged
Conversation
Adds a thin wrapper so integrations can clear cached advertisement history for a device, causing the next advertisement from that address to be treated as new data and bypass the change-detection guard in the Bluetooth manager.
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes a new supported Bluetooth API helper to clear per-device advertisement deduplication history, enabling integrations to re-receive “identical” advertisements after a device wake-up / GATT session.
Changes:
- Add
async_clear_advertisement_history(hass, address)tohomeassistant.components.bluetooth.api. - Re-export the new API from
homeassistant.components.bluetooth. - Add a regression test asserting that clearing history causes the next identical advertisement to be delivered to callbacks.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
homeassistant/components/bluetooth/api.py |
Adds a @hass_callback wrapper around the manager’s async_clear_advertisement_history. |
homeassistant/components/bluetooth/__init__.py |
Re-exports the new API function as part of the public bluetooth module surface. |
tests/components/bluetooth/test_init.py |
Adds coverage validating dedup behavior before/after clearing advertisement history. |
Merged
7 tasks
frenck
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Adds a thin wrapper around
BluetoothManager.async_clear_advertisement_historyso integrations have a supported way to clear cached advertisement history for a device; the next advertisement from that address is then treated as new data, bypassing the change-detection guard in the Bluetooth manager. Useful for devices that emit a static "I am awake" advertisement after a GATT session ends, where the deduplicator would otherwise hide the next wake-up packet from the integration's callback. The underlying habluetooth method has been available since habluetooth 5.11.0; this PR only exposes it throughhomeassistant.components.bluetooth.Background discussion: Bluetooth-Devices/habluetooth#397
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.