Skip to main content

GATT Link BLE

CI PyPI License

Connect to BLE GATT devices. Start with raw data. Add structure only when you need it.

GATT Link BLE is a lightweight Python library for discovering, connecting to, and interacting with Bluetooth Low Energy devices. Use generic GATT services and characteristics directly, or add device-specific profiles and parsers when you need structured data. Unknown devices do not need predefined profiles; device-specific interpretation stays separate from the generic client.

Features

  • Discover GATT services, characteristics, and their properties.
  • Read and write raw characteristic values.
  • Receive raw notifications and indications.
  • Choose PUSH connections or POLL_AND_DISCONNECT reads.
  • Reconnect after unexpected disconnects and restore eligible subscriptions.
  • Add optional device profiles and parsers through public registration APIs.
  • Inspect connection and characteristic diagnostics.
  • Python >=3.14.2,<3.16; built on Bleak.

Install

python -m pip install gatt-link-ble

Quick start

This example scans for a device, connects, lists its GATT services, and reads the first characteristic that advertises the read property.

import asyncio

from bleak import BleakScanner
from gatt_link_ble import ConnectionMode, GattLinkClient


async def main() -> None:
    address = input("BLE address: ")
    device = await BleakScanner.find_device_by_address(address, timeout=10)
    if device is None:
        raise RuntimeError(f"No BLE device found at {address}")

    client = GattLinkClient(device, mode=ConnectionMode.PUSH)
    try:
        await client.start()
        snapshot = await client.discover()
        for service in snapshot.services:
            print(f"Service {service.uuid}")
            for characteristic in service.characteristics:
                print(f"  {characteristic.uuid}: {sorted(characteristic.properties)}")

        readable = next(
            (
                characteristic
                for service in snapshot.services
                for characteristic in service.characteristics
                if "read" in characteristic.properties
            ),
            None,
        )
        if readable is not None:
            value = await client.read_characteristic(readable.uuid)
            print(f"Raw value: {value.hex(' ')}")
    finally:
        await client.stop()


asyncio.run(main())

Unknown BLE devices

No predefined profile? No problem.

Discover services and characteristics, inspect their properties, read or write raw values, and subscribe to notifications without registering a profile or parser. Unknown payloads remain accessible; the library does not guess their meaning, units, or data types.

Profiles and parsers

Profiles describe a device identity and its expected service/characteristic signature. Parsers interpret payloads for known characteristics. Register them independently with register_gatt_profile and register_gatt_parser; neither is required for generic GATT access.

Devices and validation

Device Status
Nordic Thingy:52 Hardware-validated reference profile, with recorded-payload regression tests.
Other BLE devices Generic GATT access (adapter/device dependent); no device-specific hardware validation.

Development

Run the test suite with uv sync --locked --all-groups && uv run pytest.

Metadata

Release files for gatt-link-ble 0.7.1

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

Source distribution (sdist)

Source distribution for gatt-link-ble 0.7.1
File Size Uploaded Provenance Actions
gatt_link_ble-0.7.1.tar.gz 72.0 kB With provenance Details for gatt_link_ble-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gatt-link-ble 0.7.1
File Interpreter ABI Platform Actions
gatt_link_ble-0.7.1-py3-none-any.whl Python 3 none any Details for gatt_link_ble-0.7.1-py3-none-any.whl

Total release size: 93.1 kB

Security for gatt-link-ble 0.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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