Unofficial Python client for the Landbook (Netprisma/Landecia) smart home cloud API — REST auth/device discovery and MQTT pub/sub.
Project description
landbook-api
Unofficial Python client for the Landbook smart home cloud API (Netprisma/Landecia), reverse-engineered from the Landbook iOS app. Covers:
- REST: email/password login, token refresh, device discovery, TSL (Thing Specification Language) model fetch, device attribute reads.
- MQTT: a persistent WebSocket/TLS pub-sub connection for real-time device control and state (
LandbookMQTTClient).
This library powers the landbook-ha Home Assistant integration, but has no dependency on Home Assistant and can be used standalone.
Installation
pip install landbook-api
Usage
from landbook_api import login, get_device_list, get_tsl, LandbookMQTTClient
bearer_token, uid, refresh_token = login("you@example.com", "your-password", region="us")
devices = get_device_list(bearer_token, region="us")
pk = devices[0]["productKey"]
dk = devices[0]["deviceKey"]
properties = get_tsl(bearer_token, pk, region="us")
client = LandbookMQTTClient(uid, bearer_token)
client.connect()
def on_message(topic_suffix: str, payload: dict) -> None:
print(topic_suffix, payload)
device_id = f"qd{pk}{dk}"
client.subscribe_device(device_id, on_message)
client.send_read(device_id, pk, dk, [p["code"] for p in properties])
Async equivalents (async_login, async_get_device_list, async_get_tsl, async_refresh_token, async_get_device_attributes) are also exported — each wraps the sync call in a thread executor.
Supported Regions
| Region | API |
|---|---|
| United States | iot-api.quectelus.com |
| Europe | iot-api.quecteleu.com |
| China | iot-gateway.quectel.com |
Pass region="us", "eu", or "cn" to any call (defaults to "us"). EU and CN are untested — reports welcome via issues.
Session Tokens
login() returns a (bearer_token, uid, refresh_token) tuple. The access token (bearer_token) is valid for 2 hours; the refresh token is valid for 30 days and must be used to obtain a new pair via refresh_token() before the access token expires. Both values should be persisted by the caller — this library does not manage token storage.
Development
pip install -e ".[test]"
pytest
Disclaimer
This is an unofficial, reverse-engineered client with no affiliation to Landbook, Netprisma, or Landecia. It may break if the upstream API changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file landbook_api-0.1.0.tar.gz.
File metadata
- Download URL: landbook_api-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8bfd07869e730d7675f67e2f0d3446513f084ca3a460e32bfccf4fa8fafee24
|
|
| MD5 |
71332a76c5329c6a1c6d3e8ea27cbb4a
|
|
| BLAKE2b-256 |
2f890bdd1d7fd945cd0802a37401e7af65b5f601329b9bb2cb6fb6bfb1052907
|
Provenance
The following attestation bundles were made for landbook_api-0.1.0.tar.gz:
Publisher:
release.yml on zackwag/landbook-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
landbook_api-0.1.0.tar.gz -
Subject digest:
b8bfd07869e730d7675f67e2f0d3446513f084ca3a460e32bfccf4fa8fafee24 - Sigstore transparency entry: 2195105433
- Sigstore integration time:
-
Permalink:
zackwag/landbook-api@bc8e2499decd803610fe8d629d2b1e6de147d393 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zackwag
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bc8e2499decd803610fe8d629d2b1e6de147d393 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file landbook_api-0.1.0-py3-none-any.whl.
File metadata
- Download URL: landbook_api-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9e027a1240aff6c326842812ab88908aa3dae96310f3b69f3c1777fb90208c9
|
|
| MD5 |
677e0aedb64699e46ce8e2d42f75d06e
|
|
| BLAKE2b-256 |
c795ac1db1bc23baf15e58bca4761e0372f1205318efec518b255498c1cbd1cd
|
Provenance
The following attestation bundles were made for landbook_api-0.1.0-py3-none-any.whl:
Publisher:
release.yml on zackwag/landbook-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
landbook_api-0.1.0-py3-none-any.whl -
Subject digest:
c9e027a1240aff6c326842812ab88908aa3dae96310f3b69f3c1777fb90208c9 - Sigstore transparency entry: 2195105444
- Sigstore integration time:
-
Permalink:
zackwag/landbook-api@bc8e2499decd803610fe8d629d2b1e6de147d393 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zackwag
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bc8e2499decd803610fe8d629d2b1e6de147d393 -
Trigger Event:
workflow_dispatch
-
Statement type: