Some checks failed
Validate / validate (push) Failing after 8s
- Add DDP client for LED strips >500 LEDs (UDP port 4048), with automatic fallback from HTTP JSON API when LED count exceeds limit - Wrap blocking operations (screen capture, image processing) in asyncio.to_thread() to prevent event loop starvation - Turn on WLED device and enable live mode when starting DDP streaming - Add LED strip offset field to calibration (rotates color array to match physical LED position vs start corner) - Add server management scripts (start, stop, restart, background start) - Fix WebUI auth error handling and auto-refresh loop - Add development API key to default config - Add i18n translations for offset field (en/ru) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4.0 KiB
4.0 KiB
Claude Instructions for WLED Screen Controller Server
Development Workflow
Server Restart Policy
IMPORTANT: When making changes to server code (Python files in src/wled_controller/), you MUST restart the server if it's currently running to ensure the changes take effect.
When to restart:
- After modifying API routes (
api/routes.py,api/schemas.py) - After updating core logic (
core/*.py) - After changing configuration (
config.py) - After modifying utilities (
utils/*.py) - After updating data models or database schemas
How to check if server is running:
# Look for running Python processes with wled_controller
ps aux | grep wled_controller
# Or check for processes listening on port 8080
netstat -an | grep 8080
How to restart:
- Stop the current server (if running as background task, use TaskStop with the task ID)
- Start a new server instance:
cd server && python -m wled_controller.main - Verify the new server started successfully by checking the output logs
Files that DON'T require restart:
- Static files (
static/*.html,static/*.css,static/*.js) - these are served directly - Locale files (
static/locales/*.json) - loaded by frontend - Documentation files (
*.md) - Configuration files in
config/if server supports hot-reload (check implementation)
Git Push Policy
CRITICAL: NEVER push commits to the remote repository without explicit user approval.
Rules
- You MAY create commits when requested or when appropriate
- You MUST NOT push commits unless explicitly instructed by the user
- If the user says "commit", create a commit but DO NOT push
- If the user says "commit and push", you may push after committing
- Always wait for explicit permission before any push operation
Workflow
- Make changes to code
- Create commit when appropriate (with user consent)
- STOP and WAIT - do not push
- Only push when user explicitly requests it (e.g., "push", "commit and push", "push to remote")
Testing Changes
After restarting the server with new code:
- Test the modified endpoints/functionality
- Check browser console for any JavaScript errors
- Verify API responses match updated schemas
- Test with different locales if i18n was modified
Project Structure Notes
src/wled_controller/main.py- FastAPI application entry pointsrc/wled_controller/api/- REST API endpoints and schemassrc/wled_controller/core/- Core business logic (screen capture, WLED client, processing)src/wled_controller/utils/- Utility functions (logging, monitor detection)src/wled_controller/static/- Frontend files (HTML, CSS, JS, locales)config/- Configuration files (YAML)data/- Runtime data (devices.json, persistence)
Common Tasks
Adding a new API endpoint:
- Add route to
api/routes.py - Define request/response schemas in
api/schemas.py - Restart the server
- Test the endpoint via
/docs(Swagger UI)
Adding a new field to existing API:
- Update Pydantic schema in
api/schemas.py - Update corresponding dataclass (if applicable)
- Update backend logic to populate the field
- Restart the server
- Update frontend to display the new field
Modifying display/monitor detection:
- Update functions in
utils/monitor_names.pyorcore/screen_capture.py - Restart the server
- Test with
GET /api/v1/config/displays
Modifying server login:
- Update the logic.
- Restart the server
Adding translations:
- Add keys to
static/locales/en.jsonandstatic/locales/ru.json - Add
data-i18nattributes to HTML elements instatic/index.html - Use
t('key')function instatic/app.jsfor dynamic content - No server restart needed (frontend only)
Authentication
Server uses API key authentication. Keys are configured in:
config/default_config.yamlunderauth.api_keys- Or via environment variables:
WLED_AUTH__API_KEYS
For development, ensure at least one API key is configured or the server won't start.