Skip to content
15 changes: 15 additions & 0 deletions homeassistant/components/bluetooth/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

if TYPE_CHECKING:
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData


def _get_manager(hass: HomeAssistant) -> BluetoothManager:
Expand Down Expand Up @@ -93,6 +94,20 @@ def async_ble_device_from_address(
return _get_manager(hass).async_ble_device_from_address(address, connectable)


@hass_callback
def async_get_discovered_devices_and_advertisement_data_by_address(
hass: HomeAssistant, address: str, connectable: bool = True
) -> list[tuple[BLEDevice, AdvertisementData]]:
"""Return all discovered [BLEDevice, AdvertisementData] tuples for an address."""
if DATA_MANAGER not in hass.data:
return []
Comment thread
dbuezas marked this conversation as resolved.
Outdated
return _get_manager(
hass
).async_get_discovered_devices_and_advertisement_data_by_address(
address, connectable
)


@hass_callback
def async_address_present(
hass: HomeAssistant, address: str, connectable: bool = True
Expand Down