feat: main's import/export, zones, audio API and web UI

Profiles, presets and sequences export and import as main's bundles.
Zones carry group_ids, preset_group_ids, sequence_ids, content_kind and
brightness; profiles seed rainbow as colour_cycle, and deleting a
profile also deletes its sequences. Groups, zones and sequences written
by older versions are migrated at boot.

/api/audio (status, event stream, start/stop, reset, anchor-bar,
devices) maps main's audio detector onto the mic's beat detector. Audio
start/stop picks whether mic beats or the BPM clock time sequences; the
clock's beats also go to the drivers while the mic is off.
/ws now greets from a post-handshake callback (httpd does not call the
handler for the upgrade).

The web UI is main's, plus v2's outputs editor, list search and
hostname/static IP settings; the bridge, Wi-Fi AP and led-tool parts
are gone. API tests follow main's behaviour (119 pass on the board).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-03 20:34:22 +13:00
1 parent 04b56c6ef2
commit bfeeb958df
44 files changed
+8709 -2338

No files matched your search

+15 -1
View File
@@ -2,7 +2,7 @@ import pytest
from helpers import new_id, unique
# Presets every new profile is seeded with (v1 controllers/profile.py)
# Presets every new profile is seeded with (main's controllers/profile.py)
SEEDED = {"on", "off", "rainbow", "Colour Cycle", "transition", "flicker", "flame", "twinkle"}
@@ -81,7 +81,21 @@ def test_clone(c, profile):
assert c.delete(f"/profiles/{clone}").status_code == 200
def test_seeded_rainbow_uses_colour_cycle(c, profile):
presets = c.get("/presets").json().values()
assert next(p for p in presets if p["name"] == "rainbow")["pattern"] == "colour_cycle"
def test_delete(c):
pid = new_id(c.post("/profiles", json={"name": unique("pytest-profile")}))
c.post(f"/profiles/{pid}/apply")
prof = c.get(f"/profiles/{pid}").json()
preset_ids = set(c.get("/presets").json())
seq = new_id(c.post("/sequences", json={"name": "pytest-seq"}))
assert c.delete(f"/profiles/{pid}").status_code == 200
assert c.get(f"/profiles/{pid}").status_code == 404
# its presets, sequences, zones and palette go with it, so a profile that reuses the id starts clean
assert not preset_ids & set(c.get("/db/preset").json())
assert not set(prof["zones"]) & set(c.get("/zones").json()["zones"])
assert prof["palette_id"] not in c.get("/palettes").json()
assert seq not in c.get("/db/sequence").json()