aiolocknalert
Async Python client for LocknAlert bridge onboarding and MQTT bootstrap.
This library is used by the Home Assistant LocknAlert integration to securely retrieve MQTT connection details from a LocknAlert bridge over HTTPS during onboarding.
Features
- Async
aiohttp-based API client - HTTPS bridge communication
- MQTT bootstrap credential retrieval
- Simple onboarding flow
- Typed exceptions for Home Assistant config flows
- Lightweight with minimal dependencies
Installation
pip install aiolocknalert
Example
from aiohttp import ClientSession
from aiolocknalert import (
LocknAlertBridgeApi,
LocknAlertCannotConnect,
LocknAlertInvalidAuth,
)
async def main() -> None:
api = LocknAlertBridgeApi("192.168.1.50")
async with ClientSession() as session:
try:
bootstrap = await api.async_bootstrap(
session,
serial_number="LNA123456",
)
print(bootstrap)
except LocknAlertCannotConnect:
print("Bridge unreachable")
except LocknAlertInvalidAuth:
print("Invalid serial number")
Bridge Onboarding Flow
- Home Assistant discovers or connects to the bridge
- User enters the LocknAlert bridge serial number
- Bridge validates the serial number against the hardware identity
- Bridge returns MQTT bootstrap credentials
- Home Assistant stores the credentials securely
Security Notes
The bridge never exposes stored MQTT credentials publicly.
MQTT bootstrap credentials are only returned when:
- The provided serial number matches the physical bridge identity
- The bridge onboarding window is active
All bridge communication occurs over HTTPS.
Requirements
- Python 3.12+
- aiohttp 3.9+
Development
Clone the repository:
git clone https://github.com/LocknAlert-Pty-LTD/aiolocknalert.git
cd aiolocknalert
Install development dependencies:
pip install -e .
pip install pytest pytest-asyncio
Run tests:
pytest
Build package:
python -m build
License
MIT License
Metadata
Release files for aiolocknalert 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiolocknalert-0.2.0.tar.gz | 19.7 kB | Without provenance | Details for aiolocknalert-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiolocknalert-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for aiolocknalert-0.2.0-py3-none-any.whl |
Total release size: 40.4 kB
Release files / aiolocknalert-0.2.0.tar.gz
| Download URL | aiolocknalert-0.2.0.tar.gz |
|---|---|
| Size | 19.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a973f3706735ce92cfbf46f799864fe5d81609a3254bb31a7da6df99da4c302
|
|
BLAKE2b-256 checksum How to use checksums |
0f577df7588c99fd37cdfc648e4baabfa5a3a0f06ed7f49b4e221ef7d1392841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / aiolocknalert-0.2.0-py3-none-any.whl
| Download URL | aiolocknalert-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
845715875dccb69d439c52f9db372e9ececeda6120253bce2a662ad1d39223ff
|
|
BLAKE2b-256 checksum How to use checksums |
d7a8536de3ecb7dde8e68931e511646fde044a4de5e22781af5e6be8cd0b5cba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for aiolocknalert 0.2.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.