Skip to main content

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

  1. 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 .
  1. 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 with no matches found: .[dev].

  1. 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 aiohttp for HTTP calls.
  • APIClient accepts base_url and an optional token (for authorization) or you can provide your own aiohttp.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 via setuptools-scm).
  • Dev/test dependencies are available under the dev extra: uv pip install -e ".[dev]" or pip 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:

  1. Fork the repo, create a branch, and make your changes.
  2. Add or update tests for new behavior.
  3. Run the test suite and ensure all tests pass.
  4. 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:

  1. Draft a GitHub Release with a tag in the form vX.Y.Z (e.g. v2.1.12).
  2. 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.
  3. 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)

Source distribution for loqedAPI 2.1.16
File Size Uploaded
loqedapi-2.1.16.tar.gz 158.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for loqedAPI 2.1.16
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

2.1.18

2 release files

This release

2.1.16 This release

2 release files

2.1.15

2 release files

2.1.14

2 release files

2.1.11

1 release file

2.1.10

1 release file

2.1.9

1 release file

2.1.8

1 release file

2.1.7

1 release file

2.1.6

1 release file

2.1.5

1 release file

2.1.4

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.1

1 release file

2.0.12

1 release file

2.0.11

1 release file

2.0.9

1 release file

2.0.8

1 release file

2.0.7

1 release file

2.0.6

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.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