Refactor Bluetooth scanners to avoid the need to pass a callback (#105607)

This commit is contained in:
J. Nick Koston 2023-12-12 22:17:48 -10:00 committed by GitHub
parent aaccf19013
commit 5dbd0dede1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 30 additions and 68 deletions

View file

@ -106,6 +106,7 @@ __all__ = [
"async_scanner_by_source",
"async_scanner_count",
"async_scanner_devices_by_address",
"async_get_advertisement_callback",
"BaseHaScanner",
"HomeAssistantRemoteScanner",
"BluetoothCallbackMatcher",
@ -287,9 +288,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
passive = entry.options.get(CONF_PASSIVE)
mode = BluetoothScanningMode.PASSIVE if passive else BluetoothScanningMode.ACTIVE
new_info_callback = async_get_advertisement_callback(hass)
manager: HomeAssistantBluetoothManager = hass.data[DATA_MANAGER]
scanner = HaScanner(mode, adapter, address, new_info_callback)
scanner = HaScanner(mode, adapter, address)
try:
scanner.async_setup()
except RuntimeError as err: