27 lines
566 B
Python
27 lines
566 B
Python
import asyncio
|
|
|
|
from bleak import BleakScanner
|
|
|
|
|
|
async def main():
|
|
print("Scanning for 20 seconds...")
|
|
|
|
devices = await BleakScanner.discover(
|
|
timeout=20.0,
|
|
return_adv=True,
|
|
)
|
|
|
|
print()
|
|
print(f"Found: {len(devices)} devices")
|
|
print()
|
|
|
|
for address, (device, adv) in devices.items():
|
|
print("ADDRESS:", address)
|
|
print("NAME:", device.name)
|
|
print("RSSI:", adv.rssi)
|
|
print("UUIDS:", adv.service_uuids)
|
|
print("SERVICE DATA:", adv.service_data)
|
|
print("-" * 60)
|
|
|
|
|
|
asyncio.run(main()) |