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.

bleak.exc.BleakError: Characteristic was not found!

See original GitHub issue
  • bleak version: 0.9.1 / 0.8.0
  • Python version: 3.8.6 / 3.8.4
  • Operating System: Windows 10 / Debian 10 (RPi3b+)
  • BlueZ: bluetoothctl: 5.50

Description

I’m trying to connect to a BLE device via bleak - it works fine when I use my script on Windows 10, but the same script fails on Linux:

bleak.exc.BleakError: Characteristic 11111111-1111-1111-1111-111111111111 was not found!

What I Did

My code:

from bleak import BleakClient
import asyncio


address = "xx:xx:xx:xx:xx:xx"
ble_uuid = "11111111-1111-1111-1111-111111111111"

msg = b'ABC'
async def run(address, loop):
        async with BleakClient(address, loop=loop) as client:
            await client.write_gatt_char(ble_uuid, msg, True)

loop = asyncio.get_event_loop()
loop.run_until_complete(run(address, loop))

The difference I see is a different bleak version on Win and on Linux. On Linux pip3 install bleak returns only bleak 0,8.0:

pip3 install bleak
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: bleak in /home/pi/.local/lib/python3.8/site-packages (0.8.0)
Traceback (most recent call last):
  File "script.py", line 13, in <module>
    loop.run_until_complete(run(address, loop))
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "script.py", line 11, in run
    await client.write_gatt_char(ble_uuid, msg, True)
  File "/home/pi/.local/lib/python3.8/site-packages/bleak/backends/bluezdbus/client.py", line 580, in write_gatt_char
    raise BleakError("Characteristic {0} was not found!".format(char_specifier))
bleak.exc.BleakError: Characteristic 11111111-1111-1111-1111-111111111111 was not found!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:51 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
dlechcommented, Aug 19, 2022
INFO:__main__:		[Descriptor] 00002902-0000-1000-8000-00805f9b34fb (Handle: 17): Client Characteristic Configuration) | Value: b''

The value should be two bytes, so there appears to be a problem with the remote device itself.

1reaction
Divya-nemuricommented, Aug 9, 2022

im getting the same issue bleak.exc.BleakError: Characteristic UUID was not found! while trying to connect to a ble device from a linux PC, i tried all the above things. i tried with both uuid’s which i got from client.get_services()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not get GATT services: Unreachable" , how to solve it?
Python's Bluetooth library of the Bleak report "bleak.exc.BleakError: Could not get GATT services: Unreachable" , how to solve it? Ask Question.
Read more >
How to use the bleak.BleakClient function in bleak - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
Source code for bleak.backends.p4android.client
__adapter is None: raise BleakError("Bluetooth is not supported on this hardware ... f"Characteristic with UUID {char_specifier} could not be found!
Read more >
I'm trying to connect to a BLE device via bleak - it works fine ...
... client.start_notify on Windows 11 and andriod , but script fails , My logcat error: bleak.exc.BleakError: Descriptor None was not found!
Read more >
bleak 0.12.1 - PyPI
Fixed BaseBleakClient.services_resolved not reset on disconnect on BlueZ backend. Merged #401. Fixed RSSI missing in discovered devices on macOS backend.
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