Files
dmx-driver/README.md
T
jimmyandClaude Sonnet 5.5 d2ffcb1969 feat: DMX gateway: Art-Net and serial out, fixtures and a pattern engine
Host gateway that takes led-controller-style commands and fans out DMX512 universes to Art-Net devices
and serial ports. Fixtures are patched onto outputs and a led-driver-style pattern engine writes channel
roles into them. Includes the vendored microdot/utemplate libs, tests and the README.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 00:46:04 +13:00

116 lines
2.8 KiB
Markdown

# DMX Driver — Art-Net + serial out gateway
Host gateway that accepts led-controller-style commands and fans out DMX512
universes to **Art-Net** devices and **serial** ports. **Fixtures** are patched
onto outputs; a led-driver-style **pattern engine** writes channel roles into
those fixtures.
## Run (desktop)
```bash
cd dmx-driver
pipenv install
pipenv run dev
```
Open **http://127.0.0.1:8080/** to manage outputs, fixtures, and play patterns.
- Web UI / API: TCP **8080**
- Art-Net out: UDP **6454** (unicast per output)
- Serial out: raw DMX512 (break + start code 0 + 512 slots), default baud **250000** 8N2
- Controller: WebSocket **`ws://127.0.0.1:8080/ws`** (`"v": "1"` presets/select)
- Pattern upload (led-driver parity): **`POST /patterns/upload?name=foo.py&reload=1`** with raw UTF-8 body
Patterns receive the same **`Preset`** object as led-driver (`preset.c`, `preset.d`,
`preset.b`, …). Seed patterns: `solid`, `blink`, `pulse`. Uploaded modules land in
`./patterns/` and reload into the registry.
Example select (fixture id or gateway name):
```json
{
"v": "1",
"presets": {
"wash": { "pattern": "blink", "colors": ["#FF0000"], "brightness": 200, "delay": 400 }
},
"select": { "f1": ["wash"] }
}
```
## Fixtures
Each fixture is bound to one **output**, a **start channel**, and a channel map
(roles: dimmer, red, green, blue, pan, tilt). Profiles seed the map:
- `parcan` — dimmer, red, green, blue
- `mover` — pan, tilt, dimmer, red, green, blue
Several fixtures may share one output universe; overlapping slots on the same
output are rejected on save. Each output has its own 512-byte buffer.
## Settings shape
```json
{
"name": "dmx-gateway",
"outputs": [
{
"id": "a1",
"type": "artnet",
"enabled": true,
"host": "192.168.1.50",
"port": 6454,
"universe": 0
}
],
"fixtures": [
{
"id": "f1",
"name": "Par 1",
"output_id": "a1",
"start_channel": 1,
"profile": "parcan",
"channels": [
{"role": "dimmer", "label": "Dimmer"},
{"role": "red", "label": "Red"},
{"role": "green", "label": "Green"},
{"role": "blue", "label": "Blue"}
]
}
]
}
```
## Tests
```bash
pipenv run test
```
## Pipenv scripts
| Script | Purpose |
|--------|---------|
| `dev` | Run the gateway locally |
| `device` | watchfiles deploy to `/dev/ttyACM0` |
| `test` | Desktop framing / fixture / pattern checks |
## Layout
```
dmx-driver/
├── lib/ # artnet, dmx, serial_dmx, microdot
├── src/
│ ├── main.py
│ ├── http_app.py
│ ├── outputs.py
│ ├── player.py
│ ├── preset.py
│ ├── controller.py
│ ├── settings.py
│ └── patterns/ # solid, blink, pulse
├── patterns/ # uploaded at runtime (gitignored)
├── tests/
└── Pipfile
```