Skip to content

Commit

Permalink
Fix handle with Bleak 0.18.1
Browse files Browse the repository at this point in the history
The callback now receives a BleakGATTCharacteristic object such that the
integer handle needs to be retrieved from an attribute.
  • Loading branch information
tvogel committed Sep 25, 2022
1 parent 09e0c29 commit a0a4f22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eq3bt/bleakconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
self._loop.run_until_complete(self._conn.disconnect())
self._conn = None

async def on_notification(self, handle, data):
async def on_notification(self, characteristic, data):
"""Handle Callback from a Bluetooth (GATT) request."""
# The notification handles are off-by-one compared to gattlib and bluepy
handle = handle + 1
handle = characteristic.handle + 1
_LOGGER.debug(
"Got notification from %s: %s", handle, codecs.encode(data, "hex")
)
Expand Down

0 comments on commit a0a4f22

Please sign in to comment.