The Dune Weaver system now supports customizable LED effects for individual patterns. This allows you to configure different LED behaviors for different patterns, creating a more immersive and customized experience.
When a pattern starts playing:
When a pattern completes:
Per-pattern LED effects are stored in the metadata cache (metadata_cache.json) alongside other pattern metadata:
{
"data": {
"hero_7loop4.thr": {
"metadata": {
"total_coordinates": 1234,
"first_coordinate": {"x": 45.5, "y": 0.25},
"last_coordinate": {"x": 350.2, "y": 0.24},
"led_effect": {
"playing": {
"effect_id": 7,
"palette_id": 0,
"speed": 150,
"intensity": 200,
"color1": "#ff0000",
"color2": "#00ff00",
"color3": "#0000ff"
},
"idle": {
"effect_id": 0,
"palette_id": 0,
"speed": 128,
"intensity": 128,
"color1": "#ffffff",
"color2": "#000000",
"color3": "#0000ff"
}
}
}
}
}
}
Get the configured LED effect for a specific pattern.
GET /api/patterns/{pattern_path}/led_effect?effect_type=playing
Parameters:
pattern_path (path): Pattern filename (e.g., hero_7loop4.thr or custom_patterns/mypattern.thr)effect_type (query): playing or idle (default: playing)Response:
{
"pattern": "hero_7loop4.thr",
"effect_type": "playing",
"settings": {
"effect_id": 7,
"palette_id": 0,
"speed": 150,
"intensity": 200,
"color1": "#ff0000",
"color2": "#00ff00",
"color3": "#0000ff"
}
}
If no custom effect is configured, settings will be null.
Configure a custom LED effect for a specific pattern.
POST /api/patterns/{pattern_path}/led_effect
Request Body:
{
"effect_type": "playing",
"effect_id": 7,
"palette_id": 0,
"speed": 150,
"intensity": 200,
"color1": "#ff0000",
"color2": "#00ff00",
"color3": "#0000ff"
}
Parameters:
effect_type: playing or idleeffect_id: Effect ID (0-15 for DW LEDs, 0-101 for WLED)palette_id: Palette ID (0-58 for DW LEDs)speed: Effect speed (0-255)intensity: Effect intensity (0-255)color1, color2, color3: Hex color codes (e.g., #ff0000)Response:
{
"success": true,
"pattern": "hero_7loop4.thr",
"effect_type": "playing",
"settings": { ... }
}
Remove custom LED effect configuration for a pattern (reverts to global settings).
DELETE /api/patterns/{pattern_path}/led_effect?effect_type=playing
Parameters:
pattern_path (path): Pattern filenameeffect_type (query): playing, idle, or omit to clear allResponse:
{
"success": true,
"pattern": "hero_7loop4.thr",
"effect_type": "playing"
}
Set the "Rainbow Cycle" effect (ID 7) to play when the hero_7loop4.thr pattern runs:
curl -X POST "http://localhost:8080/api/patterns/hero_7loop4.thr/led_effect" \
-H "Content-Type: application/json" \
-d '{
"effect_type": "playing",
"effect_id": 7,
"palette_id": 0,
"speed": 150,
"intensity": 200,
"color1": "#ff0000",
"color2": "#00ff00",
"color3": "#0000ff"
}'
Set a static blue effect when the pattern completes:
curl -X POST "http://localhost:8080/api/patterns/hero_7loop4.thr/led_effect" \
-H "Content-Type: application/json" \
-d '{
"effect_type": "idle",
"effect_id": 0,
"palette_id": 0,
"speed": 128,
"intensity": 128,
"color1": "#0000ff",
"color2": "#000000",
"color3": "#0000ff"
}'
Check if a pattern has custom LED effects configured:
curl "http://localhost:8080/api/patterns/hero_7loop4.thr/led_effect?effect_type=playing"
Remove custom effects and revert to global settings:
curl -X DELETE "http://localhost:8080/api/patterns/hero_7loop4.thr/led_effect"
For DW LED controllers, the following effects are available:
| ID | Effect Name | Description |
|---|---|---|
| 0 | Static | Solid color |
| 1 | Blink | Two colors blinking |
| 2 | Breath | Breathing/pulsing effect |
| 3 | Fade | Smooth fade between colors |
| 4 | Scan | Moving dot |
| 5 | Dual Scan | Two moving dots |
| 6 | Rainbow | Cycling hue |
| 7 | Rainbow Cycle | Rainbow across strip |
| 8 | Theater Chase | Theater-style chasing lights |
| 9-15 | Various | Additional effects |
See /api/dw_leds/effects for a complete list.
For DW LED controllers, the following color palettes are available:
| ID | Palette Name | Description |
|---|---|---|
| 0 | Default | Use custom colors |
| 1 | Rainbow | Full spectrum rainbow |
| 2 | Fire | Warm fire colors |
| 3 | Ocean | Cool blue/cyan tones |
| 4-58 | Various | Additional palettes |
See /api/dw_leds/palettes for a complete list.
Cache Manager (modules/core/cache_manager.py)
get_pattern_led_effect(): Retrieve LED effect settingsset_pattern_led_effect(): Save LED effect settingsclear_pattern_led_effect(): Remove LED effect settingsPattern Manager (modules/core/pattern_manager.py)
API Endpoints (main.py)
custom_patterns/mypattern.thr)GET /api/patterns/{pattern}/led_effectIf a pattern uses global effects instead of custom ones:
Potential future improvements: