Skip to main content

pydanalock-ble

PyPI version CI

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 DanalockLock API (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

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

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydanalock_ble-0.9.0.tar.gz (73.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydanalock_ble-0.9.0-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

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

Hashes for pydanalock_ble-0.9.0.tar.gz
Algorithm Hash digest
SHA256 2a2ae3486d845d5e8c976b55ca9ee1e607d60763fffaedde9ea2f6db5030c3ba
MD5 031ba4897497ee9fa969ae84330beb11
BLAKE2b-256 943b4dcf713878897bcece86d634520d53fbaa01df7d494f92937694cccd39ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydanalock_ble-0.9.0.tar.gz:

Publisher: publish.yml on buggy-shep/pydanalock-ble

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pydanalock_ble-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e02e009a0b76792f82722c0a723d147b3fe52f036c64512b57a83655d203639
MD5 e01903f40e424c10926f547984588405
BLAKE2b-256 0589f7bffac854aeab1297d194ebd867ea3f5803774d8bf3c6db67c768b64ace

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 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