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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydanalock_ble-0.9.0.tar.gz.
File metadata
- Download URL: pydanalock_ble-0.9.0.tar.gz
- Upload date:
- Size: 73.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a2ae3486d845d5e8c976b55ca9ee1e607d60763fffaedde9ea2f6db5030c3ba
|
|
| MD5 |
031ba4897497ee9fa969ae84330beb11
|
|
| BLAKE2b-256 |
943b4dcf713878897bcece86d634520d53fbaa01df7d494f92937694cccd39ac
|
Provenance
The following attestation bundles were made for pydanalock_ble-0.9.0.tar.gz:
Publisher:
publish.yml on buggy-shep/pydanalock-ble
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydanalock_ble-0.9.0.tar.gz -
Subject digest:
2a2ae3486d845d5e8c976b55ca9ee1e607d60763fffaedde9ea2f6db5030c3ba - Sigstore transparency entry: 2795133283
- Sigstore integration time:
-
Permalink:
buggy-shep/pydanalock-ble@ef90165b70dfbfdb260fed2d18358694f21f777d -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/buggy-shep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef90165b70dfbfdb260fed2d18358694f21f777d -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydanalock_ble-0.9.0-py3-none-any.whl.
File metadata
- Download URL: pydanalock_ble-0.9.0-py3-none-any.whl
- Upload date:
- Size: 30.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e02e009a0b76792f82722c0a723d147b3fe52f036c64512b57a83655d203639
|
|
| MD5 |
e01903f40e424c10926f547984588405
|
|
| BLAKE2b-256 |
0589f7bffac854aeab1297d194ebd867ea3f5803774d8bf3c6db67c768b64ace
|
Provenance
The following attestation bundles were made for pydanalock_ble-0.9.0-py3-none-any.whl:
Publisher:
publish.yml on buggy-shep/pydanalock-ble
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydanalock_ble-0.9.0-py3-none-any.whl -
Subject digest:
3e02e009a0b76792f82722c0a723d147b3fe52f036c64512b57a83655d203639 - Sigstore transparency entry: 2795133357
- Sigstore integration time:
-
Permalink:
buggy-shep/pydanalock-ble@ef90165b70dfbfdb260fed2d18358694f21f777d -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/buggy-shep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ef90165b70dfbfdb260fed2d18358694f21f777d -
Trigger Event:
release
-
Statement type: