Improve performance of Bluetooth device fallback (#79078)
This commit is contained in:
parent
a8b8b245d1
commit
75f6f9b5e2
10 changed files with 155 additions and 24 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Bluetooth scanner for esphome."""
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
import datetime
|
||||
|
@ -77,6 +78,10 @@ class ESPHomeScannner(BaseHaScanner):
|
|||
"""Return a list of discovered devices."""
|
||||
return list(self._discovered_devices.values())
|
||||
|
||||
async def async_get_device_by_address(self, address: str) -> BLEDevice | None:
|
||||
"""Get a device by address."""
|
||||
return self._discovered_devices.get(address)
|
||||
|
||||
@callback
|
||||
def async_on_advertisement(self, adv: BluetoothLEAdvertisement) -> None:
|
||||
"""Call the registered callback."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue