Sync smart lights with computer display

I started this project beginning 2018 after I bought a Philips Hue smart light kit. At first, I enjoyed controlling the lights manually by changing colours, intensity, setting up ambient for various activities etc. After a short while however, it became obvious what type of experience was missing.

So I started this open-source project. ( This is an experimental hobby project. I am in no way affiliated with the Philips organisation.)

The app is based on Electron JS which runs a Python script compiled with Pyinstaller.

Runs on Linux, Mac and Windows.

Requirements: Existing setup of Philips Hue Lights with a Philips Hue Bridge.

How it works (see references)
Grab a screen.
Shrink the captured image in order to increase computation speed.
Check the difference between current and previously used frame. If difference is small, skip frame.
Make a grayscale copy of the image and apply
OpenCV threshold function in order to calculate mask. Apply mask to image.
Check the count of non zero value pixels in the image. If the count is too little, then turn off/dim the lights. Brightness is calculated based on the non zero pixel count.

Apply OpenCV K Means Clustering in order to find main image colours.

Calculate the most relevant colour. If the most prevalent colour is either too dark or too bright it means that we have an image with bright or dark background. In this case we look for the next colour until we find a colour that suits the conditions.

Stereo effect

Future development: Improve auto-adjustment for low brightness frames. App can be adapted to work with multiple smart light systems from various producers at the same time. If you would like to continue the development feel free to fork, send a pull request and let’s keep in touch!


Cristian Stănciulescu


Download links, description, Github url and references on .




Leave a Reply

Your email address will not be published. Required fields are marked *