1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Fix BLEDevice not getting updated when details change for remote scanners (#90815)

This commit is contained in:
J. Nick Koston
2023-04-05 00:19:37 -10:00
committed by GitHub
parent 3ddfe027fd
commit 7cf1926081
2 changed files with 40 additions and 7 deletions

View File

@@ -481,7 +481,18 @@ async def test_device_with_ten_minute_advertising_interval(
connectable=False,
)
for _ in range(0, 20):
with patch(
"homeassistant.components.bluetooth.base_scanner.MONOTONIC_TIME",
return_value=new_time,
):
scanner.inject_advertisement(bparasite_device, bparasite_device_adv)
original_device = scanner.discovered_devices_and_advertisement_data[
bparasite_device.address
][0]
assert original_device is not bparasite_device
for _ in range(1, 20):
new_time += advertising_interval
with patch(
"homeassistant.components.bluetooth.base_scanner.MONOTONIC_TIME",
@@ -489,6 +500,13 @@ async def test_device_with_ten_minute_advertising_interval(
):
scanner.inject_advertisement(bparasite_device, bparasite_device_adv)
# Make sure the BLEDevice object gets updated
# and not replaced
assert (
scanner.discovered_devices_and_advertisement_data[bparasite_device.address][0]
is original_device
)
future_time = new_time
assert (
bluetooth.async_address_present(hass, bparasite_device.address, False) is True