Files
wled-screen-controller-mixed/plans/demo-mode/phase-1-config-flag.md
alexei.dolgolyov 2240471b67 Add demo mode: virtual hardware sandbox for testing without real devices
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>
2026-03-20 16:17:14 +03:00

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 = False field to Config class in config.py
  • Task 2: Add a module-level helper is_demo_mode() -> bool in config.py for easy import
  • Task 3: Modify StorageConfig path resolution: when demo=True, prefix all storage paths with data/demo/ instead of data/
  • Task 4: Expose demo_mode: bool in the existing GET /api/v1/system/info endpoint response
  • Task 5: Add WLED_DEMO=true env var support (already handled by pydantic-settings env prefix WLED_)

Files to Modify/Create

  • server/src/wled_controller/config.py — Add demo field, is_demo_mode() helper, storage path override
  • server/src/wled_controller/api/routes/system.py — Add demo_mode to system info response
  • server/src/wled_controller/api/schemas/system.py — Add demo_mode field to response schema

Acceptance Criteria

  • Config(demo=True) is accepted; default is False
  • WLED_DEMO=true activates demo mode
  • is_demo_mode() returns the correct value
  • When demo mode is on, all storage files resolve under data/demo/
  • GET /api/v1/system/info includes demo_mode: true/false

Notes

  • The env var will be WLED_DEMO because of env_prefix="WLED_" in pydantic-settings
  • Storage path override should happen at Config construction time, not lazily

Review Checklist

  • All tasks completed
  • Code follows project conventions
  • No unintended side effects
  • Build passes
  • Tests pass (new + existing)

Handoff to Next Phase