Metadata-Version: 2.5
Name: aioddp
Version: 0.1.0
Summary: Asyncio Python library for sending DDP pixel data to LED controllers
Project-URL: Documentation, https://amattas.github.io/aioddp/
Project-URL: Source, https://github.com/amattas/aioddp
Author-email: Anthony Mattas <anthony@mattas.net>
License: Apache-2.0
License-File: LICENSE
Keywords: ddp,home-automation,led,lighting,pixel
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Home Automation
Classifier: Typing :: Typed
Requires-Python: >=3.12
Provides-Extra: cli
Requires-Dist: click==8.5.0; extra == 'cli'
Requires-Dist: pyyaml==6.0.3; extra == 'cli'
Requires-Dist: rich==15.0.0; extra == 'cli'
Provides-Extra: dev
Requires-Dist: bandit==1.9.4; extra == 'dev'
Requires-Dist: build==1.6.1; extra == 'dev'
Requires-Dist: click==8.5.0; extra == 'dev'
Requires-Dist: mypy==2.3.0; extra == 'dev'
Requires-Dist: pre-commit==4.7.0; extra == 'dev'
Requires-Dist: pytest-asyncio==1.4.0; extra == 'dev'
Requires-Dist: pytest-cov==7.1.0; extra == 'dev'
Requires-Dist: pytest==9.1.1; extra == 'dev'
Requires-Dist: pyyaml==6.0.3; extra == 'dev'
Requires-Dist: rich==15.0.0; extra == 'dev'
Requires-Dist: ruff==0.17.2; extra == 'dev'
Requires-Dist: types-pyyaml==6.0.12.20260906; extra == 'dev'
Provides-Extra: docs
Requires-Dist: pydoc-markdown==4.8.2; extra == 'docs'
Requires-Dist: zensical==0.0.50; extra == 'docs'
Description-Content-Type: text/markdown

# aioddp

**Asyncio Python library for sending DDP pixel data to LED controllers**

[![Checks](https://github.com/amattas/aioddp/actions/workflows/checks.yml/badge.svg)](https://github.com/amattas/aioddp/actions/workflows/checks.yml)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)

aioddp is a standalone, platform-agnostic library for sending DDP (Distributed Display Protocol) pixel data to LED controllers, with a small deterministic effect library and a bench-test CLI.

> Formerly named `pyddp`; renamed to `aioddp` because the `pyddp` name on PyPI belongs to an unrelated project (a 2015 Meteor DDP client).

> Status: pre-release. Interfaces may change before 0.1.0.

## Features

- DDP v1 sender: header encode, frame chunking, push flag, sequence numbers
- Segments mapped to byte offsets, so parts of one string can be driven separately
- RGB and RGBW, configurable color order and data type byte
- Six deterministic effects and an `EffectRunner`
- Global brightness cap enforced in the library; callers can lower it but not bypass it
- Bench-test CLI for hardware bring-up
- No runtime dependencies for the core package

## Installation

```bash
pip install aioddp
pip install "aioddp[cli]"   # adds the aioddp command
```

Requires Python 3.12+.

## Library Quick Start

```python
import asyncio
from aioddp import DDPSender, EffectRunner, Segment, Strip


async def main():
    strip = Strip(host="10.0.40.20", pixel_count=300, brightness_cap=0.6)
    roof = Segment("roofline", start=0, length=260)
    peak = Segment("peak", start=260, length=40)

    async with DDPSender(strip) as tx:
        await tx.fill(roof, rgb=(255, 140, 40), brightness=0.6)
        runner = EffectRunner(tx, peak, effect="chase", fps=30, params={"speed": 1.0})
        await runner.start()
        await asyncio.sleep(10)
        await runner.stop()


asyncio.run(main())
```

Host and pixel counts are placeholders.

## CLI Quick Start

```bash
aioddp --host 10.0.40.20 query                           # ask the controller for its outputs; prints a config.yaml
aioddp --host 10.0.40.20 --count 300 test                # walk a lit pixel down the string
aioddp --host 10.0.40.20 --count 300 fill --color ff8800 --brightness 0.5
aioddp --host 10.0.40.20 --count 300 effect chase --param speed=8
aioddp --host 10.0.40.20 --count 300 off
aioddp effects                                           # list effects and params
```

Run `aioddp query` first against new hardware, then `aioddp test`. `query` uses the DDP JSON config query; a controller that does not answer it is configured by hand. Controllers that serve their layout over HTTP (the Minleon NDB-Pro) are read by the separate `pyminleon` library, which can pass the document to `aioddp.parse_config`. Host and count can also come from `config.yaml`; see `docs/superpowers/specs/2026-10-28-aioddp-cli.md`.

```python
from aioddp import discover

layout = await discover("10.0.40.20")
if layout:
    strip = Strip(host=layout.host, pixel_count=layout.pixel_count, data_type=layout.data_type)
    segments = layout.segments()  # one per active controller output
```

## Effects

| Effect | Params |
|---|---|
| `solid` (static) | `color` |
| `breathe` | `color`, `period`, `min_level` |
| `chase` | `colors`, `speed`, `spacing`, `width`, `background` |
| `twinkle` | `base_color`, `sparkle_color`, `density`, `speed` |
| `rainbow` | `speed`, `spread`, `saturation` |
| `palette` (static) | `colors`, `block_size` |

Effects are pure functions of segment length, time, params, and seed. `twinkle` uses the seed; the others ignore it.

## Documentation

https://amattas.github.io/aioddp/

## Compatibility

See [docs/compatibility.md](docs/compatibility.md) for tested controllers and how to test yours.

## Specs

Design and component specs are in `docs/superpowers/specs/`.

## License

Apache-2.0. See [LICENSE](LICENSE).
