mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Update habluetooth to 2.2.0 (#108000)
* Update habluetooth to 2.2.0 * fixes * lib
This commit is contained in:
parent
da9fc77333
commit
07810926d0
@ -20,6 +20,6 @@
|
|||||||
"bluetooth-auto-recovery==1.3.0",
|
"bluetooth-auto-recovery==1.3.0",
|
||||||
"bluetooth-data-tools==1.19.0",
|
"bluetooth-data-tools==1.19.0",
|
||||||
"dbus-fast==2.21.0",
|
"dbus-fast==2.21.0",
|
||||||
"habluetooth==2.1.0"
|
"habluetooth==2.2.0"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ dbus-fast==2.21.0
|
|||||||
fnv-hash-fast==0.5.0
|
fnv-hash-fast==0.5.0
|
||||||
ha-av==10.1.1
|
ha-av==10.1.1
|
||||||
ha-ffmpeg==3.1.0
|
ha-ffmpeg==3.1.0
|
||||||
habluetooth==2.1.0
|
habluetooth==2.2.0
|
||||||
hass-nabucasa==0.75.1
|
hass-nabucasa==0.75.1
|
||||||
hassil==1.5.2
|
hassil==1.5.2
|
||||||
home-assistant-bluetooth==1.12.0
|
home-assistant-bluetooth==1.12.0
|
||||||
|
@ -1001,7 +1001,7 @@ ha-philipsjs==3.1.1
|
|||||||
habitipy==0.2.0
|
habitipy==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.bluetooth
|
# homeassistant.components.bluetooth
|
||||||
habluetooth==2.1.0
|
habluetooth==2.2.0
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.75.1
|
hass-nabucasa==0.75.1
|
||||||
|
@ -806,7 +806,7 @@ ha-philipsjs==3.1.1
|
|||||||
habitipy==0.2.0
|
habitipy==0.2.0
|
||||||
|
|
||||||
# homeassistant.components.bluetooth
|
# homeassistant.components.bluetooth
|
||||||
habluetooth==2.1.0
|
habluetooth==2.2.0
|
||||||
|
|
||||||
# homeassistant.components.cloud
|
# homeassistant.components.cloud
|
||||||
hass-nabucasa==0.75.1
|
hass-nabucasa==0.75.1
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Tests for the Bluetooth integration."""
|
"""Tests for the Bluetooth integration."""
|
||||||
|
|
||||||
|
|
||||||
|
from collections.abc import Iterable
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
import itertools
|
import itertools
|
||||||
import time
|
import time
|
||||||
@ -295,7 +296,20 @@ class MockBleakClient(BleakClient):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class FakeScanner(BaseHaScanner):
|
class FakeScannerMixin:
|
||||||
|
def get_discovered_device_advertisement_data(
|
||||||
|
self, address: str
|
||||||
|
) -> tuple[BLEDevice, AdvertisementData] | None:
|
||||||
|
"""Return the advertisement data for a discovered device."""
|
||||||
|
return self.discovered_devices_and_advertisement_data.get(address)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def discovered_addresses(self) -> Iterable[str]:
|
||||||
|
"""Return an iterable of discovered devices."""
|
||||||
|
return self.discovered_devices_and_advertisement_data
|
||||||
|
|
||||||
|
|
||||||
|
class FakeScanner(FakeScannerMixin, BaseHaScanner):
|
||||||
"""Fake scanner."""
|
"""Fake scanner."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -8,7 +8,6 @@ from homeassistant.components import bluetooth
|
|||||||
from homeassistant.components.bluetooth import (
|
from homeassistant.components.bluetooth import (
|
||||||
MONOTONIC_TIME,
|
MONOTONIC_TIME,
|
||||||
BaseHaRemoteScanner,
|
BaseHaRemoteScanner,
|
||||||
BaseHaScanner,
|
|
||||||
HaBluetoothConnector,
|
HaBluetoothConnector,
|
||||||
async_scanner_by_source,
|
async_scanner_by_source,
|
||||||
async_scanner_devices_by_address,
|
async_scanner_devices_by_address,
|
||||||
@ -124,7 +123,7 @@ async def test_async_scanner_devices_by_address_non_connectable(
|
|||||||
rssi=-100,
|
rssi=-100,
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeStaticScanner(BaseHaScanner):
|
class FakeStaticScanner(FakeScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
|
@ -3,17 +3,18 @@ from unittest.mock import ANY, MagicMock, patch
|
|||||||
|
|
||||||
from bleak.backends.scanner import AdvertisementData, BLEDevice
|
from bleak.backends.scanner import AdvertisementData, BLEDevice
|
||||||
from bluetooth_adapters import DEFAULT_ADDRESS
|
from bluetooth_adapters import DEFAULT_ADDRESS
|
||||||
from habluetooth import HaScanner
|
|
||||||
|
|
||||||
from homeassistant.components import bluetooth
|
from homeassistant.components import bluetooth
|
||||||
from homeassistant.components.bluetooth import (
|
from homeassistant.components.bluetooth import (
|
||||||
MONOTONIC_TIME,
|
MONOTONIC_TIME,
|
||||||
BaseHaRemoteScanner,
|
BaseHaRemoteScanner,
|
||||||
HaBluetoothConnector,
|
HaBluetoothConnector,
|
||||||
|
HaScanner,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
FakeScannerMixin,
|
||||||
MockBleakClient,
|
MockBleakClient,
|
||||||
_get_manager,
|
_get_manager,
|
||||||
generate_advertisement_data,
|
generate_advertisement_data,
|
||||||
@ -26,7 +27,7 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
|
|||||||
from tests.typing import ClientSessionGenerator
|
from tests.typing import ClientSessionGenerator
|
||||||
|
|
||||||
|
|
||||||
class FakeHaScanner(HaScanner):
|
class FakeHaScanner(FakeScannerMixin, HaScanner):
|
||||||
"""Fake HaScanner."""
|
"""Fake HaScanner."""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -18,6 +18,7 @@ from homeassistant.components.bluetooth import (
|
|||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
|
FakeScannerMixin,
|
||||||
MockBleakClient,
|
MockBleakClient,
|
||||||
_get_manager,
|
_get_manager,
|
||||||
generate_advertisement_data,
|
generate_advertisement_data,
|
||||||
@ -79,7 +80,7 @@ async def test_wrapped_bleak_client_local_adapter_only(
|
|||||||
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}, rssi=-100
|
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}, rssi=-100
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
@ -155,7 +156,7 @@ async def test_wrapped_bleak_client_set_disconnected_callback_after_connected(
|
|||||||
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}, rssi=-100
|
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}, rssi=-100
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaRemoteScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaRemoteScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
@ -266,7 +267,7 @@ async def test_ble_device_with_proxy_client_out_of_connections(
|
|||||||
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
|
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaRemoteScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaRemoteScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
@ -331,7 +332,7 @@ async def test_ble_device_with_proxy_clear_cache(
|
|||||||
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
|
local_name="wohand", service_uuids=[], manufacturer_data={1: b"\x01"}
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaRemoteScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaRemoteScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
@ -434,7 +435,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
|
|||||||
"esp32_no_connection_slot",
|
"esp32_no_connection_slot",
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaRemoteScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaRemoteScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
@ -546,7 +547,7 @@ async def test_ble_device_with_proxy_client_out_of_connections_uses_best_availab
|
|||||||
"esp32_no_connection_slot",
|
"esp32_no_connection_slot",
|
||||||
)
|
)
|
||||||
|
|
||||||
class FakeScanner(BaseHaRemoteScanner):
|
class FakeScanner(FakeScannerMixin, BaseHaRemoteScanner):
|
||||||
@property
|
@property
|
||||||
def discovered_devices(self) -> list[BLEDevice]:
|
def discovered_devices(self) -> list[BLEDevice]:
|
||||||
"""Return a list of discovered devices."""
|
"""Return a list of discovered devices."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user