Skip to main content

Aqara BLE

Autonomous control of Aqara Bluetooth Low Energy locks from Python — no app, no phone — reconstructed by reverse-engineering the official application's observed behaviour. The U200 is the fully solved reference device.

Goals

  • Document the Aqara BLE + cloud protocol precisely enough to reproduce it.
  • Provide a cross-platform Python library that exposes the lock's full operation surface.
  • Enable a native Home Assistant integration (the primary target).
  • Make porting to other Aqara-family devices a methodical, repeatable process.

Quick start

Two ways in — a terminal command and an importable API. Integrations couple to the API; the CLI is just a thin adapter over that same API.

Terminal — the aqara command

pip install -e .            # puts `aqara` on your PATH
aqara login                 # account login only (no radio)
aqara scan  --transport bleak
aqara lock  --transport bumble --port serial:/dev/cu.usbmodemNNNN,115200
aqara unlock ; aqara operate keepalive

Credentials come from --account/--password or the environment/.env (AQARA_ACCOUNT, AQARA_PASSWORD, AQARA_APPID, AQARA_APPKEY, AQARA_CLIENT_ID, AQARA_PHONE_ID, AQARA_DEVICE_ID).

Library — the coupling surface for integrations

from aqara_ble import BleakTransport, CloudAuthManager, U200Client

auth = CloudAuthManager(
    account=..., password=..., appid=..., appkey=..., client_id=..., phone_id=...
)
async with await U200Client.connect(
    auth=auth, transport=BleakTransport(), device_id="lumi1.xxxx"
) as lock:
    await lock.lock()

The facade logs in (and re-authenticates on token expiry), scans and identifies the lock by what it advertises, connects, discovers services and runs the authenticated operation. Swap BleakTransport() for BumbleTransport("serial:/dev/…") to drive an ESP32‑S3 controller (firmware). Shell equivalent: python examples/lock_cli.py --transport bleak lock.

Start here

  • docs/ — the documentation entry point (understand · port · diagnose).
  • docs/devices/u200/validation.md — run it against a real U200 (facade, transports, troubleshooting).
  • docs/architecture.md — how it works end to end and the transversal-vs-device Layer Map.
  • docs/porting-guide.md — the numbered process to bring a new device online, with the CRC and login obstacles solved up front.
  • CONTRIBUTING.md — Spec-Driven Development workflow and the secret-hygiene rules.

Secrets — non-negotiable

No real secret, capture, or app source ever enters this repository. Credentials and device identifiers live only in a local, git-ignored .env (see .env.example); raw captures live under a git-ignored captures/ tree. See Constitution Principle I in .specify/memory/constitution.md.

License

See LICENSE.

Metadata

Release files for aqara-ble 1.14.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 aqara-ble 1.14.0
File Size Uploaded
aqara_ble-1.14.0.tar.gz 162.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aqara-ble 1.14.0
File Interpreter ABI Platform
aqara_ble-1.14.0-py3-none-any.whl Python 3 none any Details

Total release size: 286.5 kB

Release files / aqara_ble-1.14.0.tar.gz

Download URL aqara_ble-1.14.0.tar.gz
Size 162.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0f7c8e6da6ec383f444a3d62a94c54f976b145c98d96cfd4b07be7705a8c81a5
BLAKE2b-256 checksum
How to use checksums
c040725da55f47f05837e8535fe91dfaefbaec37b5c7a50529e0baa895e1a589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 6, 2026.

Transparency log

Release files / aqara_ble-1.14.0-py3-none-any.whl

Download URL aqara_ble-1.14.0-py3-none-any.whl
Size 123.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea6ee9abf39e88a1f4a1c2fd7f1613322f0a99193d3d3888e589f5baee7af721
BLAKE2b-256 checksum
How to use checksums
0f385f7a531da3a39036e9c41c49f0d59a83b4743fd5f1dd862e1e3b44612c97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 6, 2026.

Transparency log

Release history Release notifications | RSS feed

1.17.6

2 release files

1.17.5

2 release files

1.17.4

2 release files

1.17.3

2 release files

1.17.2

2 release files

1.17.1

2 release files

1.17.0

2 release files

This release

1.14.0 This release

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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