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):
python -m venv .venv
source .venv/bin/activate
pip install -e .
- Install dev/test dependencies (optional):
pip install -e .[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.
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
devextra: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:
- 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.
Where to find docs
- Source code is under
src/loqedAPI. - Sphinx documentation lives in
docs/.
License
See the LICENSE file in the project root.
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)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6890f9dbf865f39150e2b79d27dcdec23bb97b5bc230e4e390291dcd151a392d
|
|
| MD5 |
e32bc38ed504e2970ba9e77f45d182eb
|
|
| BLAKE2b-256 |
54de4b4683c0c3866befe632747c6be5b9a38f80f00bfb0eb3f47d159cefffae
|