No project description provided
Project description
lametric-py
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 <repository-url>
cd lametric-py
uv sync --dev
If you prefer pip:
pip install -e .
Quick Start
Local Device Client
import asyncio
from src 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 src 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 src 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 src 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 currently re-exports its public surface from src.
- 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
docs/usage.mdfor the local device and cloud clientsdocs/streaming.mdfor LMSP details and the packet format used bysend_stream_datadocs/development.mdfor local development, linting, typing, and tests
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.
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 lametric_py-1.0.6.tar.gz.
File metadata
- Download URL: lametric_py-1.0.6.tar.gz
- Upload date:
- Size: 76.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1589c481877d066017ba0b593ebf933efd1ebbf1e1f1cc40fa5c4ce9a986401c
|
|
| MD5 |
56d251297167e9a3e2d058c954fa2a1c
|
|
| BLAKE2b-256 |
f10c2d74d1670b17bc0d51e3f9fcfcc54e5935500af856dce1e4c4f36a7a5a1e
|
Provenance
The following attestation bundles were made for lametric_py-1.0.6.tar.gz:
Publisher:
ci.yml on ElectroAttacks/lametric-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lametric_py-1.0.6.tar.gz -
Subject digest:
1589c481877d066017ba0b593ebf933efd1ebbf1e1f1cc40fa5c4ce9a986401c - Sigstore transparency entry: 1234034168
- Sigstore integration time:
-
Permalink:
ElectroAttacks/lametric-py@cb18fde9325510d2abcf5866acfd8d307a08a567 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ElectroAttacks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@cb18fde9325510d2abcf5866acfd8d307a08a567 -
Trigger Event:
push
-
Statement type:
File details
Details for the file lametric_py-1.0.6-py3-none-any.whl.
File metadata
- Download URL: lametric_py-1.0.6-py3-none-any.whl
- Upload date:
- Size: 15.6 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 |
497e62c1e3a26ed4483597c6f1dd02f02f41bfe373a4b4512f5401784260c8d5
|
|
| MD5 |
00f8831de2e319f6ecabc010fc6832de
|
|
| BLAKE2b-256 |
46c7404fdc7421c4ef8986064d7b991bd99732bb78e7fe1a29235330fed65b0a
|
Provenance
The following attestation bundles were made for lametric_py-1.0.6-py3-none-any.whl:
Publisher:
ci.yml on ElectroAttacks/lametric-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lametric_py-1.0.6-py3-none-any.whl -
Subject digest:
497e62c1e3a26ed4483597c6f1dd02f02f41bfe373a4b4512f5401784260c8d5 - Sigstore transparency entry: 1234034221
- Sigstore integration time:
-
Permalink:
ElectroAttacks/lametric-py@cb18fde9325510d2abcf5866acfd8d307a08a567 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ElectroAttacks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@cb18fde9325510d2abcf5866acfd8d307a08a567 -
Trigger Event:
push
-
Statement type: