gatt-link-ble
An asynchronous, framework-independent Python library for discovering BLE GATT services, decoding sensor values, and receiving device-state updates.
The package owns BLE transport and parsing. It has no Home Assistant, MQTT, or UI-framework dependencies.
Requirements and installation
- Python 3.12 or 3.13
- BLE adapter and a device advertising supported GATT services
Install from PyPI:
python -m pip install gatt-link-ble
Poll once
import asyncio
from bleak import BleakScanner
from gatt_link_ble import ConnectionMode, GattLinkClient
async def main() -> None:
address = "AA:BB:CC:DD:EE:FF"
device = await BleakScanner.find_device_by_address(address, timeout=10)
if device is None:
raise RuntimeError(f"BLE device not found: {address}")
client = GattLinkClient(device, mode=ConnectionMode.POLL_AND_DISCONNECT)
state = await client.poll()
print(state)
asyncio.run(main())
Receive push updates
import asyncio
from bleak import BleakScanner
from gatt_link_ble import GattLinkClient
async def main() -> None:
address = "AA:BB:CC:DD:EE:FF"
device = await BleakScanner.find_device_by_address(address, timeout=10)
if device is None:
raise RuntimeError(f"BLE device not found: {address}")
client = GattLinkClient(device, state_callback=print)
await client.start()
try:
await asyncio.Event().wait()
finally:
await client.stop()
asyncio.run(main())
PUSH keeps the connection open, sends an initial state after connecting, and
reconnects after unexpected disconnects. POLL_AND_DISCONNECT reads available
characteristics once and disconnects before returning.
Supported profiles
| Profile | Service UUID | Characteristics |
|---|---|---|
| Battery Service | 0x180F |
Battery Level 0x2A19 |
| Heart Rate Service | 0x180D |
Heart Rate Measurement 0x2A37 |
| Device Information | 0x180A |
Manufacturer 0x2A29, Model 0x2A24, Firmware 0x2A26, Hardware 0x2A27 |
| Environmental Sensing | 0x181A |
Temperature 0x2A6E, Humidity 0x2A6F, Pressure 0x2A6D |
| Nordic Thingy Environment | ef680200-9b35-4933-9b10-52ffa9740042 |
Temperature, pressure, humidity, eCO2, TVOC, color/illuminance |
Parsed values are available through the immutable GattDeviceState,
DeviceMetadata, and GattSensorData models.
Inspect a device
The hardware diagnostic script lists nearby devices and, when passed an address, dumps raw bytes from readable characteristics:
uv run python scripts/live_scan.py
uv run python scripts/live_scan.py AA:BB:CC:DD:EE:FF --timeout 10
The output may include MAC addresses or other personal identifiers; redact them before sharing it publicly.
Development
uv sync --locked --all-groups
uv run ruff check .
uv run mypy src tests
uv run pytest
uv build
Tests use mocked BLE clients and GATT services; no hardware is needed.
ARCHITECTURE.md is a local implementation guide and is intentionally not
included in the public repository.
Metadata
Release files for gatt-link-ble 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gatt_link_ble-0.3.2.tar.gz | 43.5 kB | With provenance | Details for gatt_link_ble-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gatt_link_ble-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for gatt_link_ble-0.3.2-py3-none-any.whl |
Total release size: 57.6 kB
Release files / gatt_link_ble-0.3.2.tar.gz
| Download URL | gatt_link_ble-0.3.2.tar.gz |
|---|---|
| Size | 43.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03d60be5c8287e27aa2babbf95965a8b88e7355a041182524c1982d4fe49565c
|
|
BLAKE2b-256 checksum How to use checksums |
561d828cc833bfeaf11b712caebb289d9f13ff9e2ee4652ca498e29a10bbb183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / gatt_link_ble-0.3.2-py3-none-any.whl
| Download URL | gatt_link_ble-0.3.2-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2003f6e140364466298c424a51fede8d2aefcd2f2df8f6dd040131b12688048d
|
|
BLAKE2b-256 checksum How to use checksums |
5830711cc14f0e5c8f90007dc00b63b99b21dcf00be7c36db2aca18c71468f2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for gatt-link-ble 0.3.2
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.
Attestation for gatt_link_ble-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA 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.