Skip to content

Commit

Permalink
refactor: debug log bleak received data (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttu authored Dec 6, 2023
1 parent eda4193 commit 147b6f1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ruuvitag_sensor/adapters/bleak_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ async def detection_callback(device: BLEDevice, advertisement_data: Advertisemen
if 1177 not in advertisement_data.manufacturer_data:
return

log.debug("Received data: %s", advertisement_data)

data = BleCommunicationBleak._parse_data(advertisement_data.manufacturer_data[1177])

# Add RSSI to encoded data as hex. All adapters use a common decoder.
Expand All @@ -81,6 +83,8 @@ async def detection_callback(device: BLEDevice, advertisement_data: Advertisemen
scanner = _get_scanner(detection_callback)
await scanner.start()

log.debug("Bleak scanner started")

try:
while True:
next_item: Tuple[str, str] = await queue.get()
Expand All @@ -94,6 +98,8 @@ async def detection_callback(device: BLEDevice, advertisement_data: Advertisemen

await scanner.stop()

log.debug("Bleak scanner stopped")

@staticmethod
async def get_first_data(mac: str, bt_device: str = "") -> RawData:
"""
Expand Down

0 comments on commit 147b6f1

Please sign in to comment.