Twinkly Christmas Lights

I don’t use Home Assistant OS, but I know it’s very strict with regard to unsupported libraries(with good reason). So I would suggest using another vm or other solution to install xled_plus. In my case I created a python virtual environment in a Raspberry Pi, running raspbian (now Raspberry Pi OS), that also happened to be running HA Core. A Fedora VM should work but might be overkill for just running xled_plus. Regardless, start by getting xled_plus installed somewhere and to the point of running some of the examples manually from the command line before moving on to integrating it with Home Assistant.

The xled_plus project wasn’t created with Home Assistant in mind, so there’s no simple direct communication between the two. My solution was to use shell commands and python scripts to facilitate calling the xled_plus functions from outside of Home Assistant. For simply controlling on/off and brightness, I used the native Home Assistant Twinkly integration.

Once you have xled_plus working from the command line, getting Home Assistant to control XLED using my shell commands method, but from Home Assistant OS, will require doing some setup work using this guide for SSH’ing from a command line sensor or shell command. I can’t help here since I’m not on the HAOS and probably won’t be until (at least) the end of the holiday season.

My tree is still in the attic for another week or so (will probably be setting it up the weekend of Nov. 25th/26th. When I do have it up again, I can walk through my old setup and see if I can provide a clearer set of directions for setting up the HA and xled_plus scripts.

Thank you for this very helpful reply. I will be trying this soon. Thank you again

I think it’s possible if you use pyscript.

Awesome. I got it working.

I modified the xled_plus code to accept additional command line arguments (for the color and effect type) so when I change the light colors in Home Assistant, the twinkly light colors also match.

Here’s my in-progress UI for my light setup (top to bottom: light status, hue light scene selection, brightness, speed, type, twinkly effect, which areas to apply the lights, or select a specific color)

Now that I know how to do it, I’m happy to answer any questions about how to set it up.

I didn’t end up using pyscript to get this working, so not required (but I did later install pyscript to convert named colors to hsl values and also loop through the hue light scenes to get a list of unique colors to send to xled_plus)

Thanks again @gonzotek

1 Like

Excellent! I just finally got my Twinkly tree setup a couple of hours ago. I was pleasantly surprised everything I’d had setup in HA last year ‘just worked’ once I had the tree plugged in.

Excellent. My system is still only using basic on/off for 8 strands and a tree. I can’t wait to try this.