Skip to main content

lametric-py

CI PyPI Python License Docs Contributing

Async Python client for LaMetric devices and the LaMetric cloud API.

The package wraps the documented local device API, notification models, and the LaMetric Streaming Protocol (LMSP) used by LaMetric SKY devices.

Features

  • Async local device client for display, audio, Bluetooth, apps, notifications, and streaming
  • Async cloud client for account and device lookup
  • Typed dataclass models for API payloads and responses
  • Notification builders for text, goal, and chart frames
  • LMSP helpers for starting a stream and sending RGB888 UDP frames

Requirements

  • Python 3.14+
  • A LaMetric device on the local network for device API features
  • A LaMetric developer token for cloud API features

Installation

This repository is currently set up as a source install.

git clone https://github.com/ElectroAttacks/lametric-py.git
cd lametric-py
uv sync --dev

If you prefer pip:

pip install -e .

Quick Start

Local Device Client

import asyncio

from lametric import LaMetricDevice


async def main() -> None:
    async with LaMetricDevice(host="192.168.1.42", api_key="device-api-key") as device:
        state = await device.state
        print(state.name)


asyncio.run(main())

Send a Notification

import asyncio

from lametric import (
    BuiltinSound,
    LaMetricDevice,
    Notification,
    NotificationData,
    NotificationPriority,
    NotificationSound,
    SimpleFrame,
)


async def main() -> None:
    notification = Notification(
        priority=NotificationPriority.INFO,
        model=NotificationData(
            frames=[SimpleFrame(text="Deploy finished")],
            sound=BuiltinSound(id=NotificationSound.POSITIVE1),
        ),
    )

    async with LaMetricDevice(host="192.168.1.42", api_key="device-api-key") as device:
        notification_id = await device.send_notification(notification)
        print(notification_id)


asyncio.run(main())

Query the Cloud API

import asyncio

from lametric import LaMetricCloud


async def main() -> None:
    async with LaMetricCloud(token="developer-token") as cloud:
        user = await cloud.current_user
        devices = await cloud.devices
        print(user.email, len(devices))


asyncio.run(main())

Streaming Example

import asyncio

from lametric import (
    CanvasFillType,
    CanvasPostProcess,
    CanvasPostProcessType,
    CanvasRenderMode,
    LaMetricDevice,
    StreamConfig,
)


async def main() -> None:
    config = StreamConfig(
        fill_type=CanvasFillType.SCALE,
        render_mode=CanvasRenderMode.PIXEL,
        post_process=CanvasPostProcess(type=CanvasPostProcessType.NONE),
    )

    async with LaMetricDevice(host="192.168.1.42", api_key="device-api-key") as device:
        session_id = await device.start_stream(config)
        if session_id is None:
            return

        stream_state = await device.stream_state
        frame = bytes(
            [255, 0, 0]
            * (
                stream_state.canvas.pixel.size.width
                * stream_state.canvas.pixel.size.height
            )
        )
        await device.send_stream_data(session_id, frame)
        await device.stop_stream()


asyncio.run(main())

Public API

The package re-exports its public surface from lametric.

  • Clients: LaMetricDevice, LaMetricCloud
  • Exceptions: LaMetricApiError, LaMetricConnectionError, LaMetricAuthenticationError, LaMetricUnsupportedError
  • Models: apps, notifications, state payloads, stream config/state types
  • Enums: notification, screensaver, display, and streaming constants

Documentation

Full documentation is available at electroattacks.github.io/lametric-py.

Source pages:

Development

Useful commands:

uv run ruff check .
uv run ruff format .
uv run mypy .
uv run pytest

The CI workflow runs Ruff, mypy, pytest, coverage export, and semantic-release.

Support

If this package is useful to you, consider sponsoring the project. ❤️

Metadata

Release files for lametric-py 1.3.16

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

Source distribution (sdist)

Source distribution for lametric-py 1.3.16
File Size Uploaded Provenance Actions
lametric_py-1.3.16.tar.gz 115.0 kB With provenance Details for lametric_py-1.3.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lametric-py 1.3.16
File Interpreter ABI Platform Actions
lametric_py-1.3.16-py3-none-any.whl Python 3 none any Details for lametric_py-1.3.16-py3-none-any.whl

Total release size: 131.2 kB

Release files / lametric_py-1.3.16.tar.gz

Download URL lametric_py-1.3.16.tar.gz
Size 115.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9158b6cdad73f11fd0619e24538132199cbdb58323e8e189b59b286111b46e8c
BLAKE2b-256 checksum
How to use checksums
d561e8fbe1bd059b8b3ed80ee8189fe84f642ab12772ba57a69be87428b64ff8
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 7, 2026.

Transparency log

Release files / lametric_py-1.3.16-py3-none-any.whl

Download URL lametric_py-1.3.16-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae2081cf860747ddb4eaa16a5cff9151f734458d72fc33802be382de89939e4a
BLAKE2b-256 checksum
How to use checksums
55a35f0b1f4e59ada52483e357d8cc8f21cdb4bee8a2a2c225a2e25a6b538f6f
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 7, 2026.

Transparency log

Security for lametric-py 1.3.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.

Full provenance

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

Select from 2 files

Attestation for lametric_py-1.3.16.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 7, 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