Skip to content

Commit

Permalink
backends/scanner: fix tx_power missing in __repr__ when 0 (#1017)
Browse files Browse the repository at this point in the history
0 is a valid value for tx_power, so we can't use a falsy check and
need to check for None instead.
  • Loading branch information
dlech authored Sep 21, 2022
1 parent 991cce9 commit 7039456
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Changed
* ``unpair`` function of ``BleakClient`` in WinRT backend can be called without being connected to remove stored device information
* Use relative imports internally. Merged #1007.

Fixed
-----
* Fixed ``tx_power`` not included in ``AdvertisementData.__repr__`` when 0. Merged #1017.

`0.17.0`_ (2022-09-12)
======================

Expand Down
2 changes: 1 addition & 1 deletion bleak/backends/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __repr__(self) -> str:
kwargs.append(f"service_data={repr(self.service_data)}")
if self.service_uuids:
kwargs.append(f"service_uuids={repr(self.service_uuids)}")
if self.tx_power:
if self.tx_power is not None:
kwargs.append(f"tx_power={repr(self.tx_power)}")
return f"AdvertisementData({', '.join(kwargs)})"

Expand Down

0 comments on commit 7039456

Please sign in to comment.