Bump Bluetooth deps to improve auto recovery process (#144133)

This commit is contained in:
J. Nick Koston 2025-05-03 03:09:28 -05:00 committed by GitHub
parent 5e39fb6da1
commit 9780db1c22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 67 deletions

View File

@ -18,9 +18,9 @@
"bleak==0.22.3",
"bleak-retry-connector==3.9.0",
"bluetooth-adapters==0.21.4",
"bluetooth-auto-recovery==1.4.5",
"bluetooth-auto-recovery==1.5.1",
"bluetooth-data-tools==1.28.1",
"dbus-fast==2.43.0",
"habluetooth==3.45.0"
"habluetooth==3.47.1"
]
}

View File

@ -23,7 +23,7 @@ bcrypt==4.2.0
bleak-retry-connector==3.9.0
bleak==0.22.3
bluetooth-adapters==0.21.4
bluetooth-auto-recovery==1.4.5
bluetooth-auto-recovery==1.5.1
bluetooth-data-tools==1.28.1
cached-ipaddress==0.10.0
certifi>=2021.5.30
@ -34,7 +34,7 @@ dbus-fast==2.43.0
fnv-hash-fast==1.5.0
go2rtc-client==0.1.2
ha-ffmpeg==3.2.2
habluetooth==3.45.0
habluetooth==3.47.1
hass-nabucasa==0.96.0
hassil==2.2.3
home-assistant-bluetooth==1.13.1

4
requirements_all.txt generated
View File

@ -637,7 +637,7 @@ bluemaestro-ble==0.4.0
bluetooth-adapters==0.21.4
# homeassistant.components.bluetooth
bluetooth-auto-recovery==1.4.5
bluetooth-auto-recovery==1.5.1
# homeassistant.components.bluetooth
# homeassistant.components.ld2410_ble
@ -1118,7 +1118,7 @@ ha-silabs-firmware-client==0.2.0
habiticalib==0.3.7
# homeassistant.components.bluetooth
habluetooth==3.45.0
habluetooth==3.47.1
# homeassistant.components.cloud
hass-nabucasa==0.96.0

View File

@ -562,7 +562,7 @@ bluemaestro-ble==0.4.0
bluetooth-adapters==0.21.4
# homeassistant.components.bluetooth
bluetooth-auto-recovery==1.4.5
bluetooth-auto-recovery==1.5.1
# homeassistant.components.bluetooth
# homeassistant.components.ld2410_ble
@ -960,7 +960,7 @@ ha-silabs-firmware-client==0.2.0
habiticalib==0.3.7
# homeassistant.components.bluetooth
habluetooth==3.45.0
habluetooth==3.47.1
# homeassistant.components.cloud
hass-nabucasa==0.96.0

View File

@ -316,65 +316,6 @@ async def test_release_slot_on_connect_exception(
cancel_hci1()
@pytest.mark.usefixtures("enable_bluetooth", "two_adapters")
async def test_we_switch_adapters_on_failure(
hass: HomeAssistant,
install_bleak_catcher,
) -> None:
"""Ensure we try the next best adapter after a failure."""
hci0_device_advs, cancel_hci0, cancel_hci1 = _generate_scanners_with_fake_devices(
hass
)
ble_device = hci0_device_advs["00:00:00:00:00:01"][0]
client = bleak.BleakClient(ble_device)
class FakeBleakClientFailsHCI0Only(BaseFakeBleakClient):
"""Fake bleak client that fails to connect."""
async def connect(self, *args, **kwargs):
"""Connect."""
if "/hci0/" in self._device.details["path"]:
return False
return True
with patch(
"habluetooth.wrappers.get_platform_client_backend_type",
return_value=FakeBleakClientFailsHCI0Only,
):
assert await client.connect() is False
with patch(
"habluetooth.wrappers.get_platform_client_backend_type",
return_value=FakeBleakClientFailsHCI0Only,
):
assert await client.connect() is False
# After two tries we should switch to hci1
with patch(
"habluetooth.wrappers.get_platform_client_backend_type",
return_value=FakeBleakClientFailsHCI0Only,
):
assert await client.connect() is True
# ..and we remember that hci1 works as long as the client doesn't change
with patch(
"habluetooth.wrappers.get_platform_client_backend_type",
return_value=FakeBleakClientFailsHCI0Only,
):
assert await client.connect() is True
# If we replace the client, we should try hci0 again
client = bleak.BleakClient(ble_device)
with patch(
"habluetooth.wrappers.get_platform_client_backend_type",
return_value=FakeBleakClientFailsHCI0Only,
):
assert await client.connect() is False
cancel_hci0()
cancel_hci1()
@pytest.mark.usefixtures("enable_bluetooth", "two_adapters")
async def test_passing_subclassed_str_as_address(
hass: HomeAssistant,