Fix async_all_discovered_devices(False) to return connectable and unconnectable devices (#77670)

This commit is contained in:
Jc2k 2022-09-01 17:57:49 +01:00 committed by GitHub
parent d65eaf11f4
commit 93a8aef4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -221,10 +221,14 @@ class BluetoothManager:
@hass_callback
def async_all_discovered_devices(self, connectable: bool) -> Iterable[BLEDevice]:
"""Return all of discovered devices from all the scanners including duplicates."""
return itertools.chain.from_iterable(
scanner.discovered_devices
for scanner in self._get_scanners_by_type(connectable)
yield from itertools.chain.from_iterable(
scanner.discovered_devices for scanner in self._get_scanners_by_type(True)
)
if not connectable:
yield from itertools.chain.from_iterable(
scanner.discovered_devices
for scanner in self._get_scanners_by_type(False)
)
@hass_callback
def async_discovered_devices(self, connectable: bool) -> list[BLEDevice]: