Python client library for Larnitech smart home controllers
Project description
pylarnitech
Python client library for Larnitech smart home controllers (DE-MG, Metaforsa).
Provides async WebSocket and HTTP API access for device control and real-time status monitoring.
Features
- WebSocket connection with real-time status push updates
- HTTP fallback for reliable request-response operations
- Automatic reconnection with exponential backoff
- AC state hex encoding/decoding (power, mode, temperature, fan, vanes)
- Blinds state hex encoding/decoding (position, tilt)
- Temperature encoding (
statusFloat2signed 16-bit LE fixed-point) - Admin panel API for controller discovery (serial, keys, version)
- Full type hints and
py.typedmarker
Installation
pip install pylarnitech
Quick Start
import asyncio
from pylarnitech import LarnitechClient
async def main():
client = LarnitechClient(
host="192.168.4.100",
api_key="7555054131",
)
# Get all devices
devices = await client.get_devices()
for dev in devices:
print(f"{dev.addr}: {dev.type} - {dev.name}")
# Control a lamp
await client.set_device_status("388:3", {"state": "on"})
# Control AC via raw hex
await client.set_device_status_raw("407:1", "29001C620031")
# Send IR signal
await client.send_ir_signal("288:11", "196407000200A706...")
# WebSocket real-time updates
await client.connect()
client.on_status_update(lambda data: print(f"Update: {data}"))
# ... run event loop ...
await client.disconnect()
asyncio.run(main())
AC State Codec
from pylarnitech.codec import ACState
state = ACState.from_hex("39001C620431100000")
print(state.power) # True
print(state.mode) # 3 (Fan only)
print(state.temperature) # 28
print(state.fan) # 4 (Turbo)
state.temperature = 25
state.mode = 2 # Cool
print(state.to_hex()) # "29001962..."
License
MIT
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 pylarnitech-0.1.6.tar.gz.
File metadata
- Download URL: pylarnitech-0.1.6.tar.gz
- Upload date:
- Size: 70.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39366b5fbafaf2fd6f6b4c0f66e6c7cd600394b0af7a0608eaf83d367132c58d
|
|
| MD5 |
d902e5e76cce9e388666defe1219f4d8
|
|
| BLAKE2b-256 |
0d7be30188e7d03c632a73b65938dd901aeaddbc4336be3505b9134b60482aa0
|
Provenance
The following attestation bundles were made for pylarnitech-0.1.6.tar.gz:
Publisher:
workflow.yaml on parkee/pylarnitech
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylarnitech-0.1.6.tar.gz -
Subject digest:
39366b5fbafaf2fd6f6b4c0f66e6c7cd600394b0af7a0608eaf83d367132c58d - Sigstore transparency entry: 1168567313
- Sigstore integration time:
-
Permalink:
parkee/pylarnitech@c173b03c9ce1799849cea5faddb8c943337b84ab -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/parkee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@c173b03c9ce1799849cea5faddb8c943337b84ab -
Trigger Event:
push
-
Statement type:
File details
Details for the file pylarnitech-0.1.6-py3-none-any.whl.
File metadata
- Download URL: pylarnitech-0.1.6-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45b7ea7629812b774095faa19b5cf749e1054bd41b57c6b57be03db44008998c
|
|
| MD5 |
89c9dd05ae1eb4f5fa0e843962c04d50
|
|
| BLAKE2b-256 |
8050f8a315454b7ebbe2fe0ae1f79cedaec8d648ed8edf9f374b27f6c32e4c9d
|
Provenance
The following attestation bundles were made for pylarnitech-0.1.6-py3-none-any.whl:
Publisher:
workflow.yaml on parkee/pylarnitech
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylarnitech-0.1.6-py3-none-any.whl -
Subject digest:
45b7ea7629812b774095faa19b5cf749e1054bd41b57c6b57be03db44008998c - Sigstore transparency entry: 1168567377
- Sigstore integration time:
-
Permalink:
parkee/pylarnitech@c173b03c9ce1799849cea5faddb8c943337b84ab -
Branch / Tag:
refs/tags/v0.1.6 - Owner: https://github.com/parkee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@c173b03c9ce1799849cea5faddb8c943337b84ab -
Trigger Event:
push
-
Statement type: