Skip to content

Commit

Permalink
bluez: Fix passing BLEDevice(..., details=None) to BleakClient()
Browse files Browse the repository at this point in the history
BLEDevice property 'details' (with backend-specific details) is an
optional parameter.
  • Loading branch information
projectgus committed Oct 10, 2022
1 parent 1c9c84c commit 2eebda0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Fixed
* On BlueZ, support creating additional instances running on a different event
loops (i.e. multiple pytest-asyncio cases)
* Fixed unhandled exception in ``max_pdu_size_changed_handler`` in WinRT backend. Fixes #1039.
* Fixed passing BLEDevice(..., details=None) to BleakClient() on BlueZ backend.

`0.18.1`_ (2022-09-25)
======================
Expand Down
7 changes: 3 additions & 4 deletions bleak/backends/bluezdbus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ def __init__(self, address_or_ble_device: Union[BLEDevice, str], **kwargs):
self._adapter: Optional[str] = kwargs.get("adapter", kwargs.get("device"))

# Backend specific, D-Bus objects and data
if isinstance(address_or_ble_device, BLEDevice):
self._device_path = None
self._device_info = None
if isinstance(address_or_ble_device, BLEDevice) and address_or_ble_device.details:
self._device_path = address_or_ble_device.details["path"]
self._device_info = address_or_ble_device.details.get("props")
else:
self._device_path = None
self._device_info = None

# D-Bus message bus
self._bus: Optional[MessageBus] = None
Expand Down

0 comments on commit 2eebda0

Please sign in to comment.