Loqed Touch Smart Lock — Python client
This repository provides a small async-first Python client for the Loqed Touch smart lock. It wraps the HTTP API used by Loqed devices and exposes convenient helpers to read lock state, send lock/unlock commands, and manage webhooks.
Quick start
- Install the package (recommended: in a virtualenv):
Using uv (recommended):
uv venv
uv pip install -e .
Using pip:
python -m venv .venv
source .venv/bin/activate
pip install -e .
- Install dev/test dependencies (optional):
uv pip install -e ".[dev]"
or with pip:
pip install -e ".[dev]"
Note: quote
.[dev](as above) — in zsh, an unquoted.[dev]is interpreted as a glob pattern and fails withno matches found: .[dev].
- Use the client (async):
import asyncio
from loqedAPI.loqed import APIClient, LoqedAPI
async def main():
client = APIClient(base_url="https://api.loqed.com", token="your-api-token")
api = LoqedAPI(client)
# fetch a lock by id
lock = await api.async_get_lock("lock-id")
print("state:", lock.bolt_state)
# send an unlock command
await lock.unlock()
asyncio.run(main())
Notes:
- The library is async-first and uses
aiohttpfor HTTP calls. APIClientacceptsbase_urland an optionaltoken(for authorization) or you can provide your ownaiohttp.ClientSession.
Online status
Lock.online is True when the lock is connected to the bridge. It is read from lock_online in the /status response (refreshed by Lock.update()) and kept current by trigger_online_status webhooks (bit 8, enabled by the default registerWebhook flags), which carry ble_strength (-1 means not connected) and wifi_strength.
While the lock is offline the bridge reports battery_percentage as -1, so check lock.online before using the battery value.
Testing
Run the test suite with pytest (the project uses pytest-asyncio and aioresponses).
With uv (no need to activate the venv or pre-install anything — uv run syncs the
dev extra into an ephemeral environment automatically):
uv run --extra dev pytest --cov=src/loqedAPI --cov-report=term-missing
With pip/a manually activated venv:
source .venv/bin/activate
pytest --cov=src/loqedAPI --cov-report=term-missing
Development
- The package follows standard Python packaging with
pyproject.toml(version is derived from git tags viasetuptools-scm). - Dev/test dependencies are available under the
devextra:uv pip install -e ".[dev]"orpip install -e ".[dev]". - When editing code, run the tests frequently. The tests are fast and designed to mock network calls.
Contributing
If you want to contribute:
- Fork the repo, create a branch, and make your changes.
- Add or update tests for new behavior.
- Run the test suite and ensure all tests pass.
- Open a pull request with a short description of the change.
Releasing
Releases are built and published to PyPI automatically by a public GitHub Actions
workflow (.github/workflows/release.yml) — there is no manual/local publish step.
To cut a release:
- Draft a GitHub Release with a
tag in the form
vX.Y.Z(e.g.v2.1.12). - Publish the release. The package version is derived from the tag via
setuptools-scm, so the version on PyPI always matches a tagged commit in this repository. - CI runs the test suite, builds the sdist/wheel, and publishes to PyPI using PyPI Trusted Publishing (no stored API tokens).
Where to find docs
- Source code is under
src/loqedAPI. - Sphinx documentation lives in
docs/.
License
See the LICENSE file in the project root.
Metadata
Release files for loqedAPI 2.1.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| loqedapi-2.1.16.tar.gz | 158.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loqedapi-2.1.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 169.7 kB
Release files / loqedapi-2.1.16.tar.gz
| Download URL | loqedapi-2.1.16.tar.gz |
|---|---|
| Size | 158.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d31ee6e605e0bf1d80d6c3492c673399fcc57e379ae2e2bee996791118673f30
|
|
BLAKE2b-256 checksum How to use checksums |
dc41c4c2ea946a07c32aa4f7f2a99f5945bf9926a516346e85407b0e1815cdd5
|
| 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 30, 2026.
Transparency logRelease files / loqedapi-2.1.16-py3-none-any.whl
| Download URL | loqedapi-2.1.16-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d90212bd96467501be02d2754acd178cc63468339665b971d7555f2f47c361f7
|
|
BLAKE2b-256 checksum How to use checksums |
05569cdabd1f1a584ae36b1da49fb95812ee88d18f4c6a1a2c3d35fbff4a6e60
|
| 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 30, 2026.
Transparency log