Skip to main content
pygatt - Python Module for Bluetooth LE Generic Attribute Profile (GATT).
====

This Module allows reading and writing to GATT descriptors on devices such as
fitness trackers, sensors, and anything implementing standard GATT Descriptor behavior.

pygatt wraps BlueZ's `gatttool` command-line utility with a Pythonic API.


Motivation
----

`gatttool` has an interactive mode but it is difficult to use programatically.
Ideally we could use BlueZ directly, but that's a much bigger task.


Dependencies
----
* Currently only tested under Linux as it requires `gatttool` which is included with BlueZ which is a Linux library.
* BlueZ >= 5.5
* Tested on 5.18 and 5.21
* Ubuntu is stuck on BlueZ 4.x and does not work - you need to build BlueZ
from source.


Installation
----
* Install via pip: `$ pip install pygatt`


Usage Example
----
Connect to a bGeigie Nano using BLEBee and decode sensor data (NMEA-like):

.. code:: python

import pygatt

str_buf = ''
def print_str_buf(x,y):
global str_buf
str_y = "%s" % y
if str_y == '$':
print str_buf
sb = str_y
else:
str_buf = str_buf + str_y

pygatt.util.reset_bluetooth_controller()
bgn = pygatt.pygatt.BluetoothLEDevice('00:07:80:71:D5:89')
bgn.connect()
bgn.char_write(32, bytearray([0x03, 0x00]))
bgn.subscribe('a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b', print_str_buf)
bgn.run()

This should print something like:

.. parsed-literal::

$BNRDD,2359,2014-12-14T09:46:47Z,32,2,2398,A,3745.6045,N,12229.8638,W,50.40,A,8,87*5B


Author
----
Greg Albrecht <gba@orionlabs.co> https://github.com/ampledata

Derived from the work of several others, see NOTICE.


License
----
Apache License, Version 2.0. See LICENSE.


Copyright
----
Copyright 2015 Orion Labs, Inc.


Source
----
https://github.com/ampledata/pygatt

Release files for pygatt 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygatt 1.1.0
File Size Uploaded
pygatt-1.1.0.tar.gz 6.8 kB Details

Release files / pygatt-1.1.0.tar.gz

Download URL pygatt-1.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
42817e663da36735f2d0a68c5a76408d485821d65143611c5c83816eb9b064d2
BLAKE2b-256 checksum
How to use checksums
a217460ffed01aa91b1fb6a63cbf8f18b257d31ff31496a11c507d807d9bf06a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

5.0.0

2 release files

4.0.5

1 release file

4.0.4

1 release file

4.0.3

1 release file

4.0.1

1 release file

4.0.0

1 release file

3.2.0

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

This release

1.1.0 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page