Automating Plex with RGB Lighting: A Colorful Experience

Hey everyone! I’ve been diving into some exciting home automation projects lately, and I wanted to share one that’s been particularly fun to set up. I’ve managed to automate my RGB lighting to change based on the dominant color of the current movie or TV show poster on Plex. It’s a cool way to enhance the viewing experience!

The Setup

I’m using OpenHAB as my automation platform, paired with a Shelly RGBW Duo bulb. The magic happens through a Python script that analyzes the poster image and extracts the dominant color. Here’s a quick breakdown of how it works:

  1. Python Script: The script takes the URL of the current Plex poster as input and returns the Hue, Saturation, and Brightness values of the dominant color.
  2. OpenHAB Rule: When Plex changes to ‘Playing’ state, the script runs, and the resulting color values update the RGB bulb.

Challenges and Solutions

Initially, I tried running the script directly on my OpenHAB server (a Raspberry Pi 3), but it was too slow. Moving the script to my Windows-based Plex server made a world of difference in performance. I also had to tweak the OpenHAB rule to ensure smooth transitions between colors.

Results

The end result is pretty seamless! As soon as a new movie or show starts, the lights adjust to match the poster’s dominant color. It adds a cinematic touch to my home theater setup, and it’s been a hit with friends and family.

Tips for Others

  • Python Libraries: Make sure to install the ColorThief library for image analysis.
  • SSH Access: Ensure SSH is enabled on both your OpenHAB and Plex servers for script execution.
  • Script Placement: Running the script on a more powerful machine (like my Windows box) made a huge difference in speed.

If anyone has questions or wants to try this out, feel free to ask! I’d love to hear how others are enhancing their media experiences with automation. Cheers! :clapper::sparkles: