Skip to content

Commit

Permalink
Replace deprecated BLEDevice.rssi by AdvertisementData.rssi (#114)
Browse files Browse the repository at this point in the history
Bleak 0.20.0 deprecates BLEDevice.rssi. This PR replaces this
attribute by AdvertisementData.rssi, introduced in Bleak 0.19.0.
This also bumps the minimal Bleak version required by Theengs
Gateway to 0.19.0.
  • Loading branch information
koenvervloesem authored Mar 20, 2023
1 parent 72fc6d5 commit fc11d34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions TheengsGateway/ble_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ async def ble_scan_loop(self):

def detection_callback(self, device, advertisement_data):
"""Detect device in received advertisement data."""
logger.debug(
"%s RSSI:%d %s", device.address, device.rssi, advertisement_data
)
logger.debug("%s:%s", device.address, advertisement_data)

# Try to add the device to dictionary of clocks to synchronize time.
self.add_clock(device.address)
Expand Down Expand Up @@ -319,7 +317,7 @@ def detection_callback(self, device, advertisement_data):

if data_json:
data_json["id"] = device.address
data_json["rssi"] = device.rssi
data_json["rssi"] = advertisement_data.rssi
decoded_json = decodeBLE(json.dumps(data_json))

if decoded_json:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
setup_requires=setup_requires,
include_package_data=True,
install_requires=[
"bleak>=0.15.0",
"bleak>=0.19.0",
"bluetooth-clocks<1.0",
"bluetooth-numbers>=1.0,<2.0",
"paho-mqtt>=1.6.1",
Expand Down

0 comments on commit fc11d34

Please sign in to comment.