How to create rule to match LED indicator color to bulb color

I currently own 2 Inovelli Blue series switches, and really like them.

It took me a while to figure out how to use the Button Manager to control on/off as well as dim/fade the Hue lamps with the switch, but I did get that working!!!

Now… I would like to create an automation that will mimic the current color (hue) of the lightbulbs onto the LED status bar. It doesn’t have to be perfect, just close. My thinking is that there should be some conditional that captures the current state of the bulb, and read the Hue Light’s hue/color value, then set the LED color to match.

Lacking any ‘cookbook’ on capturing and setting values, can someone please offer some advice on how to do this? (If it’s even possible)!

Thank you

I think the best way to do this would be to modify "parameter" (they're stealing Z-Wave terms for Zigbee, but I'm rolling with it :smile:) 95, the "LED color when on" configuration option, to match the smart bulb color. This would be possible if it were exposed as a command not a preference, but apps can't modify preferences. so that won't work. You could use a "notification" instead, via the LedEffectAll() command, but this assumes you don't have other uses for notifications (only one can be active at a time and a new one will "overwrite" the old one) or care that they can be "cancelled" (double-tapping the config button or from the hub).

If that's not a problem, you could do something like this in Rule Machine:

First, create:

Local Variables: two of type Number, which I'll call color and level

Then, the general idea for the actual rule:

Trigger: "Custom Attribute" with color or colorTemperature "changed" as triggers; you could also use just colorName, which would roughly capture both but won't necessarily get smaller changes. The device would be your smart bulbs.

Actions to Run:

Set level (variable) to device attribute: bulb level
IF (Bulb colorMode 'RGB') THEN
  Set color (variable) to device attribute: bulb hue
  Set color (variable) to color * 100
  Set color (variable) to color / 255
  ledEffectAll(1,color,level,255)
ELSE
  ledEffectAll(1,255,level,255)
END-IF

It's hard to convey some of the specifics here, but the actions like "Set color (variable)..." are the variable operations under the "Set Variable, Mode or File, Run Custom Action" menu, then "Set Variable." Choose your variable (color and level for me, but the name doesn't matter), then the operation, either "device attribute" or "variable math" in these cases.

The ledEffectAll action is a custom action, under "Set Variable, Mode or File, Run Custom Action", then "Run Custom Action." You'll be prompted to choose the device (first by a capability; any the device supports, like Dimmer, will work), then the command, then the parameters. There are four parameters, all of type number. For some parameters, you'll use the variable instead of a literal value, which should be apparent from the above.

You can refine this a bit more if you want. Maybe you don't care about level and can just use 100 to make it full brightness or whatever you want. Maybe you care about shades of white (I'm cheating a bit and just using 255 for the color value here, which is "white" on the LED, sort of a medium/cool white to my eyes; it can't do color temperature, so this is probably the easiest option--but it won't necessarily match).

Also, given that this is a notification (and "solid" type), the LED bar will always be full instead of matching the level like the "regular" bar does. By default, you'll still see that for a few seconds when manually operating the switch, then it will return to the notification.

I suspect what you want might be a bit better with a custom command to just set the LED bar color(s). I'm working on a custom driver that does this, but my Zigbee understanding, especially for a device with this immensely large number of configuration options, is not as good as I would like to be confident enough in this to make my own, so right now I have one substantially based on Inovelli's with some changes. I could share if you want.

2 Likes

Thanks… I’ll certainly give that a try in the morning.

I do understand that you can only have one effect active at a time, and for this instance, I won’t be needing to ‘use’ the LED notifier effects on this switch.

I’ll report back on what I discover.

Again, thanks!

It kinda-sorta is exposed via the setPrivateCluster command. You pass in 95 as the Attribute, then the color value, and then the bit size of 8.

For example, if you want to set the "LED color when On" to Red then you can use this command:

setPrivateCluster(95,0,8)

95 is the 'preference' number
0 is the color (red)
8 is the bitsize (8bits =1byte = 0-255)

If you want to change the intensity (brightness) of the led bar then use attribute 97 ('preference' 97 = LED Bar Intensity when On)

1 Like

Mark, thanks for sending this over. I see where the 95 attribute comes into play… if I want basic colors, that would work I think. What do you know about the color wheel?

That particular item in the list of attributes doesn’t seem to have an attribute number/code assigned to it.

In the grand scheme of things, I think that somehow capturing the current on color of the bulb (on the 360° scale, and making the second item match) would be as close as I’m looking for!

Sadly, I’m still rather dipping my toes into HE programming, and as a non-coder, I’m slowly fumbling my way through this stuff!

(However, if you need to purchase and design enterprise scale disk storage systems, I’m your guy!)

Yeah, the issue is that the zigbee firmware is expecting a byte value (8bits) so the range is 0-255. A standard color wheel is 0-360, so you have to convert. For example, the Inovelli default Blue is 240 on the color wheel with a 0-360 scale. To convert you divide by 360 and multiply by 255. So.....

240/360*255=170

You would enter 170 as the color value to get Blue. Note that a value of 255 is a special case to mean "White" on the Inovelli

Download the Hubitat app