2

I'm trying to communicate with an ESP32 microcontroller and my linux desktop using Bluetooth Low Energy.

Right now I'm using the notification example from https://pypi.org/project/pygatt/ (carefully replacing the MAC address and UUID of course).

The pygatt library runs gatttool under the hood, and is pretty flaky. Sometimes the example reports a single value before the program terminates. Sometimes it reports a spate of values and then hangs.

I was wondering if there were any alternatives to pygatt that were more robust?

spierepf
  • 2,774
  • 2
  • 30
  • 52

1 Answers1

1

gatttool is one of the eight tools that BlueZ deprecated.

BlueZ publishes an API using D-Bus and there are various D-Bus bindings for Python

For a BLE client you will need the following API parts of BlueZ:

An example of how to do this with pydbus is at: https://stackoverflow.com/a/63751113/7721752

There are also a number of other BLE Python libraries available on PyPI but not all of them built using the BlueZ supported D-Bus API.

ukBaz
  • 6,985
  • 2
  • 8
  • 31