Demo mode provides a complete sandbox environment with: - Virtual capture engine (radial rainbow test pattern on 3 displays) - Virtual audio engine (synthetic music-like audio on 2 devices) - Virtual LED device provider (strip/60, matrix/256, ring/24 LEDs) - Isolated data directory (data/demo/) with auto-seeded sample entities - Dedicated config (config/demo_config.yaml) with pre-configured API key - Frontend indicator (DEMO badge + dismissible banner) - Engine filtering (only demo engines visible in demo mode) - Separate entry point: python -m wled_controller.demo (port 8081) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.9 KiB
1.9 KiB
Phase 1: Demo Mode Config & Flag
Status: ⬜ Not Started Parent plan: PLAN.md Domain: backend
Objective
Add a demo boolean flag to the application configuration and expose it to the frontend via the system info API. When demo mode is active, the server uses an isolated data directory so demo entities don't pollute real user data.
Tasks
- Task 1: Add
demo: bool = Falsefield toConfigclass inconfig.py - Task 2: Add a module-level helper
is_demo_mode() -> boolinconfig.pyfor easy import - Task 3: Modify
StorageConfigpath resolution: whendemo=True, prefix all storage paths withdata/demo/instead ofdata/ - Task 4: Expose
demo_mode: boolin the existingGET /api/v1/system/infoendpoint response - Task 5: Add
WLED_DEMO=trueenv var support (already handled by pydantic-settings env prefixWLED_)
Files to Modify/Create
server/src/wled_controller/config.py— Adddemofield,is_demo_mode()helper, storage path overrideserver/src/wled_controller/api/routes/system.py— Adddemo_modeto system info responseserver/src/wled_controller/api/schemas/system.py— Adddemo_modefield to response schema
Acceptance Criteria
Config(demo=True)is accepted; default isFalseWLED_DEMO=trueactivates demo modeis_demo_mode()returns the correct value- When demo mode is on, all storage files resolve under
data/demo/ GET /api/v1/system/infoincludesdemo_mode: true/false
Notes
- The env var will be
WLED_DEMObecause ofenv_prefix="WLED_"in pydantic-settings - Storage path override should happen at
Configconstruction time, not lazily
Review Checklist
- All tasks completed
- Code follows project conventions
- No unintended side effects
- Build passes
- Tests pass (new + existing)