question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device Failing to Connect

See original GitHub issue
  • bleak version: 0.14.2
  • Python version: 3.9
  • Operating System: Windows 11 Build: 22000.613
  • BlueZ version (bluetoothctl -v) in case of Linux:

Description

I am a first-time bleak user and want to talk to a GATT server with a known address. Connection can be established as shown within Windows Bluetooth settings however it seems like Bleak never recognizes that the device connects and is stuck waiting

What I Did

async with BleakClient(address) as client: print(‘connected’)

Force quitting this yields the following error:

  ----> 1 async with BleakClient(address) as client:
        2         print('connected')
  ~\anaconda3\lib\site-packages\bleak\backends\client.py in __aenter__(self)
       59 
       60     async def __aenter__(self):
  ---> 61         await self.connect()
       62         return self
       63 
  ~\anaconda3\lib\site-packages\bleak\backends\winrt\client.py in connect(self, **kwargs)
      273 
      274         # Obtain services, which also leads to connection being established.
  --> 275         await self.get_services()
      276 
      277         return True
  
  ~\anaconda3\lib\site-packages\bleak\backends\winrt\client.py in get_services(self, **kwargs)
      444             logger.debug("Get Services...")
      445             services: Sequence[GattDeviceService] = _ensure_success(
  --> 446                 await self._requester.get_gatt_services_async(
      447                     BluetoothCacheMode.UNCACHED
      448                 ),
  
  CancelledError: 
  
  
  
  
  
  ```

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
nickbedburycommented, Aug 4, 2022

I updated to bleak==0.15.1 and am able to connect now. I haven’t done an exhaustive test, but 5 attempts were successful in a row, which seems improved from before.

The hold-up recording Wireshark for me is permission related (work laptop, no admin rights).

I am still unable to write to a CHRC, but perhaps that is some other problem. --> EDIT: can confirm this is a different issue. (needed response=True)

0reactions
dlechcommented, Jul 28, 2022

I am not able to capture Wireshark presently. I’m not too familiar with doing that for Bluetooth…but it shows no activity when I enabled capture.

There are instructions on how to do this at https://bleak.readthedocs.io/en/latest/troubleshooting.html#windows-10

Read more comments on GitHub >

github_iconTop Results From Across the Web

Device Failed to Connect - Microsoft Community
Device Failed to Connect. For some reason my camera has stopped showing up in Windows Explorer when I connect USB, and I am...
Read more >
Device Can't Connect to Wi-Fi? Here's What to Do
Check these Wi-Fi network issues first · Check to see if your router is unplugged or if the power is cut off —...
Read more >
Fix internet connection problems on Android devices
If you can't access the Internet on your Android device, either through an app or a ... Open your Settings app and tap...
Read more >
Failed to connect devices or constantly lost connections?
If you meet a connection problem (for example, failed to connect devices, constantly lost connections), it may be due to the network of...
Read more >
How to Fix Bluetooth Pairing Problems - Techlicious
1. Make sure Bluetooth is turned on · 2. Determine which pairing process your device employs · 3. Turn on discoverable mode ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found