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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user