Skip to content

Commit

Permalink
backends/scanner: fix BLEDevice name not updated
Browse files Browse the repository at this point in the history
Observed on macOS: sometimes the peripheral name is not populated the
first time an advertisement callback is made. Since we were not updating
the device with the new name, it was stuck as `None`.
  • Loading branch information
dlech committed Feb 19, 2023
1 parent cd6b3d9 commit 9a5f53c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Fixed
* Fixed leaking services when ``get_services()`` is cancelled in WinRT backend.
* Fixed WinRT scanner never calling ``detection_callback`` when a device does
not send a scan response. Fixes #1211.
* Fixed ``BLEDevice`` name sometimes incorrectly ``None``.

`0.19.5`_ (2022-11-19)
======================
Expand Down
1 change: 1 addition & 0 deletions bleak/backends/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def create_or_update_device(
try:
device, _ = self.seen_devices[address]

device.name = name
device._rssi = adv.rssi
device._metadata = metadata
except KeyError:
Expand Down

0 comments on commit 9a5f53c

Please sign in to comment.