pydanalock-ble
Unofficial async Python client library for Danalock V3 smart locks over Bluetooth Low Energy. Key material is obtained from the sibling cloud client pydanalock-cloud and passed in as opaque bytes.
from pydanalock.ble import DanalockLock
lock = DanalockLock(
"AA:BB:CC:DD:EE:FF",
serial=bytes.fromhex("010203040506"),
login_token=blob_from_your_cloud_client,
trust_anchor=anchor_der_bytes,
)
async with lock:
print(await lock.state())
print(await lock.battery())
unlock() and lock() are only ever called by your code — the library
never moves the lock implicitly.
Disclaimer. This project is unofficial and is not affiliated with, endorsed by, or sponsored by Danalock AS or Poly-Control. It is built for interoperability with devices you own. Use it at your own risk; only control devices you are authorized to control.
Install
pip install pydanalock-ble
Status
Work in progress. Development is spec-first; see specs/ for the
protocol specifications and their status.
Implemented:
- DMI frame codec (envelope, byte stuffing, CRC-16) — spec 0001
- Reliable delivery layer (sequence/acknowledgement, retransmissions) and GATT transport — spec 0002
- TLS 1.2 session (ECDHE-ECDSA-AES-256-GCM-SHA384, extended master secret, lock certificate validation) — spec 0003
- Application command layer and the public async
DanalockLockAPI (connect/login/state/battery/unlock/lock) — spec 0004 - Passive state from BLE advertisements — spec 0005
- Lock settings read and write (read 4.6, one-member writes with verification reads) — spec 0006
- Device information read (product, hardware version, firmware version, firmware identifier) — spec 0008
Requirements
- Python >= 3.11
- bleak >= 3.0
- cryptography >= 44
Development
python3 -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/ruff check .
.venv/bin/ruff format --check .
.venv/bin/mypy
.venv/bin/pytest -m "not live"
Synthetic protocol test vectors (shape mirrors observed frames; no real
device data) live in tests/vectors/. Live tests (real lock) stay behind
the live marker and are run manually only.
License
Metadata
Release files for pydanalock-ble 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydanalock_ble-0.10.0.tar.gz | 76.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydanalock_ble-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.3 kB
Release files / pydanalock_ble-0.10.0.tar.gz
| Download URL | pydanalock_ble-0.10.0.tar.gz |
|---|---|
| Size | 76.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
056c7baff1feb60a06461e0fea8f86e1c4178ef19b2975b76adf952197842af1
|
|
BLAKE2b-256 checksum How to use checksums |
3bcd636adb43f68c036ec49407853a1aa33d9c498677c565576307d87e2cdbc5
|
| 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 12, 2026.
Transparency logRelease files / pydanalock_ble-0.10.0-py3-none-any.whl
| Download URL | pydanalock_ble-0.10.0-py3-none-any.whl |
|---|---|
| Size | 31.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65ef943d5958f72a57c90f408c2f7b953f33fa98f449caf28aacdfb948cca0a6
|
|
BLAKE2b-256 checksum How to use checksums |
ebca0d18f7f9d70f67b87a222096ccc77ec86c607d0e36fc24e6e37f3d6061ed
|
| 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 12, 2026.
Transparency log