Real-time screen color synchronization for Philips Hue and IKEA Dirigera smart lights.
AmbiSync captures your screen content, analyzes the dominant colors in three zones (left, center, right), and updates your smart lights to match. This creates an immersive ambient lighting effect that extends your screen into your room.
- Screen Capture: Uses
mss(or PIL fallback) to capture your screen at configurable FPS (5-30) - Color Analysis: Divides screen into 3 zones, downsamples for performance, calculates dominant color per zone
- Smart Processing:
- Automatically dims lights for dark content
- Converts BGRA to RGB on Windows
- Handles multi-monitor setups
- Light Control: Updates smart lights with calculated colors
Download from Releases:
Windows:
AmbiSync-vX.X.X-Windows.exe
Double-click to run.
macOS:
AmbiSync-vX.X.X-macOS.dmg
Open and drag to Applications.
Linux (all distros):
Option 1: With installer (recommended)
tar -xzf AmbiSync-vX.X.X-Linux-x86_64.tar.gz
cd AmbiSync-vX.X.X
./install.sh
ambisyncOption 2: Standalone binary
chmod +x AmbiSync-vX.X.X-Linux-x86_64
./AmbiSync-vX.X.X-Linux-x86_64Prerequisites:
- Python 3.9+
- tkinter
Installation:
git clone https://github.com/Chafficui/AmbiSync.git
cd AmbiSync
pip install -r requirements.txt
python run_ambisync.py- Start AmbiSync
- Click Settings (β)
- Configure your smart lights:
- Bridge IP: Find in Hue app β Settings β Bridge
- Username: Click "π Generate" β Press bridge button β Wait for confirmation
- Hub IP: Find in IKEA Home app β Settings β Hub
- Token: Click "π Generate" β Press action button on hub bottom β Wait for confirmation
Switch to "Light Mapping" tab - lights are auto-discovered.
Click on lights to assign them to zones:
- Left Zone: Lights for left side of screen
- Center Zone: Lights for center/behind screen
- Right Zone: Lights for right side of screen
Lights can be assigned to multiple zones.
- FPS: Update frequency (5-30). Lower = less CPU usage. Default: 15
- Brightness: Light brightness (50-254). Default: 200
- Monitor: Select which monitor to capture (auto-detected)
All settings auto-save.
- Configure lights (first time only)
- Click "βΆ Start Sync"
- Lights follow screen colors
- Click "βΈ Stop Sync" to stop (lights turn off automatically)
Settings are stored in:
- Linux/macOS:
~/.config/ambisync/config.json - Windows:
C:\Users\USERNAME\.config\ambisync\config.json
Example:
{
"hue_enabled": true,
"hue_bridge_ip": "192.168.1.100",
"hue_username": "abc123...",
"dirigera_enabled": false,
"fps": 15,
"brightness": 200,
"monitor_index": 1,
"light_mapping": {
"left": ["hue_1", "hue_2"],
"center": ["hue_3"],
"right": ["hue_4"]
}
}AmbiSync/
βββ src/
β βββ controllers/ # Light controller implementations
β β βββ hue_controller.py
β β βββ dirigera_controller.py
β βββ core/ # Core logic
β β βββ color_analyzer.py # Screen capture & color extraction
β β βββ sync_engine.py # Main synchronization loop
β βββ gui/ # User interface
β β βββ main_window.py
β β βββ setup_wizard.py
β βββ utils/ # Utilities
β βββ config.py
β βββ color_utils.py
βββ run_ambisync.py # Entry point
βββ requirements.txt # Dependencies
- Capture screen using
mss(or PIL on fallback) - Convert BGRA β RGB (Windows compatibility)
- Downsample image by factor of 15 for performance
- Split into 3 horizontal zones
- Calculate mean color per zone
- Apply darkness handling (dim/blue tint for black content)
- Update lights via API
- Screen capture: ~5-10ms (mss) or ~50ms (PIL)
- Color analysis: ~2-5ms
- API calls: ~10-50ms per light (async)
- Total latency: ~50-100ms per frame
Philips Hue:
- REST API:
PUT /api/{username}/lights/{id}/state - Payload:
{"on": true, "bri": 200, "xy": [x, y]}
IKEA Dirigera:
- Python library:
dirigera - WebSocket-based communication
Wayland Issue:
xhost +local:Or log in with X11 session instead of Wayland.
Auto-fallback: App automatically switches to PIL if mss fails.
Fixed in v2.0+ (BGRA β RGB conversion).
- Verify network connectivity (lights and PC on same network)
- Test connection in Settings
- Check light IDs in mapping
- Ensure lights are powered on
- Lower FPS (try 10 instead of 15)
- Reduce number of lights
- Check for other screen recording software
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
git clone https://github.com/Chafficui/AmbiSync.git
cd AmbiSync
pip install -r requirements.txt
python run_ambisync.py- Follow PEP 8
- Use type hints where possible
- Add docstrings to functions/classes
- Test on multiple platforms before submitting
Builds are automated via GitHub Actions. To test locally:
pip install pyinstaller
pyinstaller --name=AmbiSync --onefile --windowed run_ambisync.pyThis project is licensed under the MIT License - see the LICENSE file for details.
- dirigera - IKEA Dirigera Python client
- mss - Fast screen capture
- Philips Hue API - Smart light control
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ for ambient lighting enthusiasts