Skip to main content

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).
  • Local LAN control: a direct TCP connection to a device on the local network, bypassing the cloud entirely (LandbookLocalClient) — see LOCAL_CONTROL.md.

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])

# Re-read state after every automatic reconnect.
client.on_connect = lambda: client.send_read(device_id, pk, dk, [p["code"] for p in properties])

An unexpected disconnect is retried automatically (calling token_refresher, if one was passed, before each attempt) until disconnect() or halt_reconnects(). Writes sent while the connection is briefly down are queued and replayed on reconnect; reads are dropped, so on_connect is the place to re-read state.

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.

Metadata

Release files for landbook-api 0.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for landbook-api 0.10.1
File Size Uploaded Provenance Actions
landbook_api-0.10.1.tar.gz 52.2 kB With provenance Details for landbook_api-0.10.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for landbook-api 0.10.1
File Interpreter ABI Platform Actions
landbook_api-0.10.1-py3-none-any.whl Python 3 none any Details for landbook_api-0.10.1-py3-none-any.whl

Total release size: 78.5 kB

Release files / landbook_api-0.10.1.tar.gz

Download URL landbook_api-0.10.1.tar.gz
Size 52.2 kB
Tags Source
SHA-256 checksum
How to use checksums
371f3f33b08b3fea5b2ce1e5374249afec63b2d7a6bf3c6a59825fdc3311123e
BLAKE2b-256 checksum
How to use checksums
c16c35ae2e34d83d252dfe742f5129516b56f6112f69c8a53ac41524f32b466d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Release files / landbook_api-0.10.1-py3-none-any.whl

Download URL landbook_api-0.10.1-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caf009ff9d2860498bc481aea06b296209a29d51ce9633700ed4218c770d7202
BLAKE2b-256 checksum
How to use checksums
b1dc9b5a7023510db461a9b319995dddb28e73fc57da62ecee95b189b5efb52e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 18, 2026.

Transparency log

Security for landbook-api 0.10.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for landbook_api-0.10.1.tar.gz

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 Nov 18, 2026.

Transparency log

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.

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