Skip to main content

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 (statusFloat2 signed 16-bit LE fixed-point)
  • Admin panel API for controller discovery (serial, keys, version)
  • Full type hints and py.typed marker

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylarnitech-0.2.5.tar.gz (72.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylarnitech-0.2.5-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pylarnitech-0.2.5.tar.gz.

File metadata

  • Download URL: pylarnitech-0.2.5.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylarnitech-0.2.5.tar.gz
Algorithm Hash digest
SHA256 3834b51d3a6e05f1de8271679f2eca41ef9dba17b2c60aea37d4e4bc028dc6d7
MD5 313713b5fc37a1d31523def89740ff2e
BLAKE2b-256 3b57825f69fc699443507f852c0bf2b7fed59a4b82d1a3f821a5adc4cdb3b445

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylarnitech-0.2.5.tar.gz:

Publisher: workflow.yaml on parkee/pylarnitech

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pylarnitech-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: pylarnitech-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylarnitech-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4ea73e94ecd7642e2b5a0d1122437312de6c4431aca5452fc3b748deb517f8f5
MD5 2e39f72910b297f2c291753c250369c6
BLAKE2b-256 956b47f2dbb90ffa6b4cec8b9ebd3ca4b51b196dead93571d1a756d4b649c436

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylarnitech-0.2.5-py3-none-any.whl:

Publisher: workflow.yaml on parkee/pylarnitech

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page