Skip to content

Commit c062be4

Browse files
committed
Fix handle with Bleak 0.18.1
The callback now receives a BleakGATTCharacteristic object such that the integer handle needs to be retrieved from an attribute.
1 parent 5c4fa55 commit c062be4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

eq3bt/bleakconnection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
8383
self._loop.run_until_complete(self._conn.disconnect())
8484
self._conn = None
8585

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

0 commit comments

Comments
 (0)