You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import asyncio
from typing import Sequence
from bleak import BleakClient, BleakScanner
from bleak.backends.device import BLEDevice
async def find_all_devices_services()
scanner = BleakScanner()
devices: Sequence[BLEDevice] = scanner.discover(timeout=5.0)
for d in devices:
async with BleakClient(d) as client:
print(client.services)
asyncio.run(find_all_devices_services())
python3 test.py
Traceback (most recent call last):
File "/home/user/Downloads/bleak/examples/test.py", line 16, in <module>
asyncio.run(find_all_devices_services())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/home/user/Downloads/bleak/examples/test.py", line 11, in find_all_devices_services
for d in devices:
TypeError: 'coroutine' object is not iterable
sys:1: RuntimeWarning: coroutine 'BleakScanner.discover' was never awaited
The text was updated successfully, but these errors were encountered:
bluetoothctl -v
) in case of Linux: 5.64Description
Just pointing out an error in the documentation
What I Did
Copied the following code from https://bleak.readthedocs.io/en/latest/troubleshooting.html into test.py
The first error was
Once corrected by adding a :, I got the error:
The text was updated successfully, but these errors were encountered: