4f4d17c44dfd3c5d278f7b0bdb9f085dadde5770
Implements transparent on-screen overlay that displays LED calibration data directly on the target display for easier setup and debugging. Overlay shows border zones, LED position axes with tick labels, and calibration details. Features: - Tkinter-based transparent overlay window with click-through support - Border zones highlighting pixel sampling areas (colored rectangles) - LED position axes with numbered tick marks at regular intervals - Calibration info box showing target name, LED counts, and configuration - Toggle button (eye icon) in target cards for show/hide - Localized UI strings (English and Russian) Implementation: - New screen_overlay.py module with OverlayWindow and OverlayManager classes - Overlay runs in background thread with proper asyncio integration - API endpoints for start/stop/status overlay control - overlay_active state tracking in processor manager Known limitation: tkinter threading cleanup causes server restart when overlay is closed, but functionality works correctly while overlay is active. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
WLED Screen Controller
Ambient lighting controller that synchronizes WLED devices with your screen content for an immersive viewing experience.
Overview
This project consists of two components:
- Python Server - Captures screen border pixels and sends color data to WLED devices via REST API
- Home Assistant Integration - Controls and monitors the server from Home Assistant OS
Features
- 🖥️ Multi-Monitor Support - Select which display to capture
- ⚡ Configurable FPS - Adjust update rate (1-60 FPS)
- 🎨 Smart Calibration - Map screen edges to LED positions
- 🔌 REST API - Full control via HTTP endpoints
- 🏠 Home Assistant Integration - Native HAOS support with entities
- 🐳 Docker Support - Easy deployment with Docker Compose
- 📊 Real-time Metrics - Monitor FPS, status, and performance
Requirements
Server
- Python 3.11 or higher
- Windows, Linux, or macOS
- WLED device on the same network
Home Assistant Integration
- Home Assistant OS 2023.1 or higher
- Running WLED Screen Controller server
Quick Start
Server Installation
-
Clone the repository
git clone https://github.com/yourusername/wled-screen-controller.git cd wled-screen-controller/server -
Install dependencies
pip install . -
Run the server
uvicorn wled_controller.main:app --host 0.0.0.0 --port 8080 -
Access the API
- API: http://localhost:8080
- Interactive docs: http://localhost:8080/docs
Docker Installation
cd server
docker-compose up -d
Configuration
Edit server/config/default_config.yaml:
server:
host: "0.0.0.0"
port: 8080
processing:
default_fps: 30
border_width: 10
wled:
timeout: 5
retry_attempts: 3
API Usage
Attach a WLED Device
curl -X POST http://localhost:8080/api/v1/devices \
-H "Content-Type: application/json" \
-d '{
"name": "Living Room TV",
"url": "http://192.168.1.100",
"led_count": 150
}'
Start Processing
curl -X POST http://localhost:8080/api/v1/devices/{device_id}/start
Get Status
curl http://localhost:8080/api/v1/devices/{device_id}/state
See API Documentation for complete API reference.
Calibration
The calibration system maps screen border pixels to LED positions. See Calibration Guide for details.
Example calibration:
{
"layout": "clockwise",
"start_position": "bottom_left",
"segments": [
{"edge": "bottom", "led_start": 0, "led_count": 40},
{"edge": "right", "led_start": 40, "led_count": 30},
{"edge": "top", "led_start": 70, "led_count": 40},
{"edge": "left", "led_start": 110, "led_count": 40}
]
}
Home Assistant Integration
- Copy
homeassistant/custom_components/wled_screen_controllerto your Home Assistantcustom_componentsfolder - Restart Home Assistant
- Go to Settings → Integrations → Add Integration
- Search for "WLED Screen Controller"
- Enter your server URL
Development
Running Tests
cd server
pytest tests/ -v
Project Structure
wled-screen-controller/
├── server/ # Python FastAPI server
│ ├── src/wled_controller/ # Main application code
│ ├── tests/ # Unit and integration tests
│ ├── config/ # Configuration files
│ └── pyproject.toml # Python dependencies & project config
├── homeassistant/ # Home Assistant integration
│ └── custom_components/
└── docs/ # Documentation
Troubleshooting
Screen capture fails
- Windows: Ensure Python has screen capture permissions
- Linux: Install X11 dependencies:
apt-get install libxcb1 libxcb-randr0 - macOS: Grant screen recording permission in System Preferences
WLED not responding
- Verify WLED device is on the same network
- Check firewall settings
- Test connection:
curl http://YOUR_WLED_IP/json/info
Low FPS
- Reduce
border_widthin configuration - Lower target FPS
- Check network latency to WLED device
- Reduce LED count
License
MIT License - see LICENSE file
Contributing
Contributions welcome! Please open an issue or pull request.
Acknowledgments
- WLED - Amazing LED control software
- FastAPI - Modern Python web framework
- mss - Fast screen capture library
Support
- GitHub Issues: Report a bug
- Discussions: Ask a question
Languages
Python
46.7%
TypeScript
39.2%
HTML
7.9%
CSS
5.7%
PowerShell
0.3%
Other
0.1%