Skip to content

Commit a0a4f22

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 09e0c29 commit a0a4f22

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
@@ -79,10 +79,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
7979
self._loop.run_until_complete(self._conn.disconnect())
8080
self._conn = None
8181

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

0 commit comments

Comments
 (0)