diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c0917c6e..7109415a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,6 +25,7 @@ Fixed * Fixed BlueZ version in passive scanning error message. Fixes #1433. * Fixed mypy requiring ``Unpack[ExtraArgs]`` that were intended to be optional. Fixes #1487. * Fixed ``KeyError`` in BlueZ ``is_connected()`` and ``get_global_bluez_manager()`` when device is not present. Fixes #1507. +* Fixed BlueZ _wait_removed completion on invalid object path. `0.21.1`_ (2023-09-08) ====================== diff --git a/bleak/backends/bluezdbus/manager.py b/bleak/backends/bluezdbus/manager.py index 488dbb7b..6c835d21 100644 --- a/bleak/backends/bluezdbus/manager.py +++ b/bleak/backends/bluezdbus/manager.py @@ -812,8 +812,9 @@ async def _wait_removed(self, device_path: str) -> None: event = asyncio.Event() - def callback(_: str): - event.set() + def callback(o: str): + if o == device_path: + event.set() device_removed_callback_and_state = DeviceRemovedCallbackAndState( callback, self._properties[device_path][defs.DEVICE_INTERFACE]["Adapter"]