[RELEASE] WLED Universal Driver

Hi everyone!

I've been a happy user of the WLED community driver for a while, but I always found it lacking a few features I ended up borrowing from the from HomeAssistant integration. So eventually I decided to tinker with the original driver from Bryan Li (bryan@joyful.house) to see if I could add what I was missing.

One thing led to another, and I ended up doing a pretty big overhaul to get it up to speed with the latest WLED API. I think what came out of it is pretty useful, so I wanted to share it with all of you in case you find it helpful too!

A huge shout-out to Bryan Li for creating the original driver that made all this possible.

Here's what it can do:

The Basics

  • Full support for On/Off, Level, Color, and Color Temperature.
  • It works great with the "Color & Temperature Light" dashboard tile!
  • Complete control over your Presets.
  • Has the standard siren and strobe alarm features.

Cooler Stuff for Automations

  • Set Effects by Name: You don't have to remember Effect IDs anymore! Just use names like "Fire 2012".
  • Set Palettes by Name: Same deal for color palettes.
  • Full Playlist Support: You can start and stop your saved WLED playlists right from Hubitat.
  • Reverse Effect: There's a simple switch to make your effects run backward, which is pretty handy for rules!

Reliability Stuff

  • It's fully asynchronous, so it won't slow down your hub.
  • It keeps an eye on the connection and will let you know if something's wrong.
  • It can automatically retry commands if the first try fails.
  • You can use commands like listEffects to see everything your WLED controller can do, right in the logs.
  • It also shows you the firmware version of your device.

Getting it Installed

The easiest way is definitely with the Hubitat Package Manager (HPM) .

  1. In HPM, just go to "Install" -> "Search by Keywords".
  2. Search for "WLED" and pick "WLED Universal" .

Or, the Manual Way

  1. Grab the code from the WLED_Universal.groovy file.
  2. Copy all of it.
  3. In your Hubitat hub, head over to Drivers Code and click +New Driver .
  4. Paste in the code and hit Save .
  5. Just assign the "WLED Universal" type to your WLED device, save, and then hit the forceRefresh button. You'll be all set!

Let me know what you think!

Since this is my first time sharing a driver, I'd love to hear what you think! Any feedback, ideas, or bug reports are totally welcome.

9 Likes

Looks interesting. I'm heading out to an event Wednesday so I won't get a chance to reprogram one of my WLED devices until I get back.

Out of curiosity, what is the "Both" control?

image

Note, you can add a description to the inputs to provide more information:

input "baseDelay", "number", title: "Enter default delay duration", defaultValue: 60, submitOnChange: true,
	description: "<font size='1em'>This delay is used to calculate how long after motion stops before the lights turn off.</font>"

image

1 Like

I was wondering the same thing when I started.
It is apparently a common implementation for alarm capable devices. There is supposed to be a "strobe", a "siren" and a "both" control, combining both effects (which it actually does not in this case).
I took that kind of as is from the original implementation and never thought about it again.
Original:

// Alarm Functions
def siren(){
    // Play "Siren" effect
    logDebug("Alarm \"siren\" activated")
    setEffect(38,255,255,0)
}

def strobe(){
    // Set Effect to Strobe
    logDebug("Alarm strobe activated")
    setEffect(23,255,255,0)
}

def both(){
    //Cannot do both, default to strobe
    strobe()
}

Now that I thought about it, WLED devices may not be a classic alarm device capable of doing a these natively, but with all the effects available there are probably better suited to simulate this.
I will change the implementation to have a proper "both" option using "Strobe Mega" effect which seems ok for this:

def siren() { 
    // Use Chase Flash effect with Fire palette for intense red siren alarm
    setEffectByName("Chase Flash", 255, 255, "Fire") 
}

def strobe() { 
    // Use Strobe effect with white/default palette for visual alarm
    setEffectByName("Strobe", 255, 255, "Default") 
}

def both() { 
    // Use Strobe Mega effect with Red & Blue palette for emergency alarm
    // Strobe Mega provides intense, attention-grabbing flashes perfect for "both" alarm
    setEffectByName("Strobe Mega", 255, 255, "Red & Blue") 
}

Thanks for the tip about the description. I will add a couple of those, too.

Quick question: will this toggle the master power of a wled device on/off and not just the segments of the device? Toggling the master power is the only way that the quinled boards will trigger the output relay to turn a 120v power source on or off so this is a key feature for me. If so, looking forward to trying this out, I was really greateful for the original driver by Bryan Li as this was the only way to bring WLED devices into Hubitat's automation capabilities but the driver hasn't received much love as of late.

Yes, the driver will toggle the master power off if the setting "Power Off Main Controller with Segment" is enabled in device preferences (default value for this is false). This is pretty much unchanged from the original.

I am sure you are aware of this and this is how your setup works, I'll still state it for the protocoll: If powering off the main relay on the QinLED board will trigger your 120V main power source to shut down, too, you want to make sure there is an independent power source for the ESP32 controller, so it can receive a power on signal via network.

I was thinking about how to implement multi segment support, will have to think of another way to handle main power toggle then, too.