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 ) 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.