Skip to main content

Python package to use the Loqed Smart Door Lock APIs in a local network. To be used by Home Assistant.

Project description

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):
python -m venv .venv
source .venv/bin/activate
pip install -e .
  1. Install dev/test dependencies (optional):
pip install -e .[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.

Testing

Run the test suite with pytest (the project uses pytest-asyncio and aioresponses):

source .venv/bin/activate
pytest --cov=src/loqedAPI --cov-report=term-missing

Development

  • The package follows standard Python packaging with pyproject.toml/setup.py.
  • Dev/test dependencies are available under the dev extra: 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.

Where to find docs

  • Source code is under src/loqedAPI.
  • Sphinx documentation lives in docs/.

License

See the LICENSE file in the project root.

Project details


Download files

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

Source Distribution

loqedapi-2.1.11.tar.gz (12.7 kB view details)

Uploaded Source

File details

Details for the file loqedapi-2.1.11.tar.gz.

File metadata

  • Download URL: loqedapi-2.1.11.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for loqedapi-2.1.11.tar.gz
Algorithm Hash digest
SHA256 6890f9dbf865f39150e2b79d27dcdec23bb97b5bc230e4e390291dcd151a392d
MD5 e32bc38ed504e2970ba9e77f45d182eb
BLAKE2b-256 54de4b4683c0c3866befe632747c6be5b9a38f80f00bfb0eb3f47d159cefffae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page