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
Running this simple script works well on m2 macbook Sonoma 14.1.2, but fails on macbook intel 10.14, as it returns an empty list.
asyncdefmain():
scanner=BleakScanner(service_uuids=[SERVICE_UUID])
awaitscanner.start()
# Wait for 5 seconds to find the deviceawaitasyncio.sleep(5)
awaitscanner.stop()
devices=awaitscanner.get_discovered_devices()
print(devices)
compass=Nonefordeviceindevices:
ifdevice.nameandDEVICE_NAMEindevice.name:
compass=deviceifcompassisNone:
print("Could not find the compass device. Try restarting the wearable.")
returntry:
asyncwithBleakClient(compass.address) asclient:
# Read the value of the characteristicawaitclient.start_notify(CHARACTERISTIC_UUID, handle_audio_data)
whileTrue:
awaitasyncio.sleep(1)
exceptExceptionase:
print(e)
print(f"Error: {e}")
asyncio.run(main())
Initially had a script without specifying service_uuids, but that failed as well.
Could not find the compass device. Try restarting the wearable.
Logs
no errors
The text was updated successfully, but these errors were encountered:
Hmm... I suppose the behavior could have changed in the CoreBluetooth implementations between macOS versions. I doubt I have a version of macOS that old for testing though.
As a workaround, you can move the service UUID check elsewhere.
# Wait for 5 seconds to find the device
Tip: Using BleakScanner.find_device_by_name() would save you from always having to wait 5 seconds and would save you a lot of lines of code.
async with BleakClient(compass.address) as client:
Tip: just pass compass instead of compass.address, otherwise it has to scan again.
Initially had a script without specifying service_uuids, but that failed as well.
Oh, didn't see that part. Not sure what could be going on in that case then. You could try logging Bluetooth packets as described in the troubleshooting page of the docs.
Description
Discover bluetooth devices
What I Did
Running this simple script works well on m2 macbook Sonoma 14.1.2, but fails on macbook intel 10.14, as it returns an empty list.
Initially had a script without specifying
service_uuids
, but that failed as well.Logs
no errors
The text was updated successfully, but these errors were encountered: