Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bleak (python) does not respond on connect

I have found the correct Bluetooth address of the device I want to connect to. When I run the code below, it prints "Connecting to device..." but then hangs and never prints "Connected" or finishes running. No errors are thrown.

import asyncio
from bleak import BleakClient

address = "24:71:89:cc:09:05" # Replaced with actual bluetooth address

async def main(address):
    print("Connecting to device...")
    async with BleakClient(address) as client:
        print("Connected")

asyncio.run(main(address))

Is this issue related to my PC software/drivers? I am on a Lenovo laptop running Windows 11.

Or, do some devices not respond to simple "connection requests"? The device I am connecting to is a Tesla Model 3, and I know there is a particular set of data I should be sending to authenticate. If this is the case, how do I send data without connecting with a BleakClient in this way?

Update: I should mention that scanning / discovering devices works just fine via Bleak. And, I tried connecting to other devices via Bleak and the same issue occurred. Bluetooth through the Windows Settings app works fine though.

like image 754
kbrin-1372 Avatar asked May 11 '26 06:05

kbrin-1372


1 Answers

I was also having issues using any bleak commands beyond discover(). I downgraded from 0.14.3 to 0.14.0 and that resolved my problem.

like image 93
Xyphota Avatar answered May 12 '26 20:05

Xyphota



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!