What capability to use for Alexa to control color of power sequence controlled lights

I have some color pool lights. I'd like to control their color using Alexa in HE. For example,

Alexa, turn the pool lights blue.

I currently do it using a Smart Home skill on a Lambda server + a python script running locally on an rpi. It works, but I'm trying to migrate everything to HE.

The colors are changed by sequencing through the supported colors (only 8) using bursts of fast (< 1 second) on/off sequences. For example, blue is 5 on/off cycles, red is 6 on/off cycles.

For Alexa, I think I need to implement a custom driver that advertises ColorControl capability so that Alexa will recognize commands like "Change pool light color to blue". I think I'll need to implement setHue, setColor, and setSaturation methods and that these will get called by Alexa.

Are there other alternatives (different capabilities) I should consider? What I'd really like is a capability that just gets the text that Alexa recognized, then the driver could parse it and do whatever is needed. That would require no compromise in flexibility, but I don't see that in HE.

Suggestions welcome!

What you say sounds correct to me. As far as I know, there is no way to get a "text" color from Alexa to your driver, and either Alexa or perhaps the Hubitat skill is doing conversion from name to hue (and possibly saturation) behind the scenes for users.

1 Like

Well, here’s another way. It’s how I have Alexa turn on our patio fireplace LED controller (Napoleon GSS48; controller is Napoleon LED Controller (N190-0002)).

The trigger is a virtual switch exposed to Alexa, and the Patio Fireplace Lights Relay is a Zooz ZEN16.

I thought about that. I'd need a virtual switch for every color and I'd have to do an utterance like "turn on pool lights blue".

It would work, but the utterances required would be awkward, I think. Maybe I'm missing something?

Nope, you assessed it correctly. You asked for suggestions, which is why I posted, just to make sure you had considered this option.

Thanks, @672southman. I'm so new I'm likely to miss something obvious. Also, I couldn't see a way to parameterize the repeat count. So, I'd need multiple instances of the same rule that differ only by the repeat count.

The example driver GenericZigbeeRGBWBulb.groovy has a "SetGenericName" that takes hue as an input and returns a corresponding color name string.

That's going to be helpful for what I need to do, but it's a little "wifey". :grinning: A color named "Spring"? For my pool, hues from Chartreuse through Cyan will be simply "green". (all my pool lights can do).

Right, but keep in mind that this is for display purposes only. The platform doesn't really use it for anything (honestly, no idea why it's even there...I seem to remember maybe Google Home liking it for some reason, but in light of these other facts I'm still not sure why), and it's number-to-color only, not the other way around. So it's just a different way of representing data you already have and won't affect how Alexa responds to color names.

I use a modified version to get a color name from the hue that was sent as a result of an Alexa utterance.

Just saved a little time in looking up a color wheel and getting the groovy syntax right (I'm brand new to Groovy.

Works great--all the supported colors result in the correct string--other colors map to the color name with the closest hue.

Glad you got something working! I should reiterate in case it isn't clear that the colorName attribute value doesn't really do anything (and setGenericName() is just a helper method internal to that driver, also nothing special--it is not a standard device command, just something this driver calls when it wants to update this attribute because the author, wisely, thought it was wise to make this a separate method and not shove thismcose into multiple places elsewhere in the driver). You could make this method return "blarfengaar" for any hue/sat or CT, but Alexa would respond the same way it already does. :slight_smile: (Which is converting names to hue/saturation or CT before they even make their way to your driver.)

Download the Hubitat app