Color Indicator split into 255 segments

Hello,
I am trying to make a DTH for a “Mi Light Bulb”; this is based on the simulated RGBW Bulb, and sends an AutoRemote command to an android tablet running Tasker for execution.

I am currently stuck on integrating the colors… The documentation says colors are split into 255 HEX segments (0x00 to 0xFF) which seem to fade between each other, but examples are only given in increments of 16:

Violet,0x00,#EE82EE
RoyalBlue,0x10,#4169E1
LightSkyBlue, 0x20,#87CEFA
Aqua,0x30,#00FFFF
AquaMarine, 0x40,#7FFFD4
SeaGreen,0x50,#2E8B57
Green,0x60,#008000
LimeGreen,0x70,#32CD32
Yellow,0x80,#FFFF00
Goldenrod,0x90,#DAA520
Orange,0xA0,#FFA500
Red,0xB0,#FF0000
Pink,0xC0,#FFC0CB
Fuchsia, 0xD0,#FF00FF
Orchid,0xE0,#DA70D6
Lavender,0xF0,#E6E6FA

The simulated bulb returns a value in “ColorIndicator”, which is
1&HUE%&if(SAT%<100,0&SAT%,100)

Does anyone know of a way to work out the ColorIndicators of the 255 segments?
Any assistance you can offer is greatly apprecited.

The 255 segments they’re referring to is probably the hex RGB values.
R: 238 (EE)
G: 130 (82)
B: 238 (EE)

You can use the built-in “colorUtil.hexToHsv(hex)” function to convert that hex into hue, saturation, and value, but I have no clue what other hex value (0x00) on that line is for.

The “0x00” is the first of the 255 segments - each value representing a different color.
Unfortunately, it is not refering to the RGB Value…

I think that the value is a direct correlation to the HUE. Using this, I came up with a table of the HEX value with its ColorIndicator; the top and bottom colors on the 360 color sphere are correct (ie pressing Green will send the green HEX), but the left and right are reversed (ie pressing Blue sends the Red HEX).
Any idea how I can rectify this?

I wish I could help, but I’ve only worked with Z-Wave RGB Bulbs/Controllers so I’m not familiar with what this device is doing…

Thanks anyway, @krlaframboise.

Anyone else have any ideas?
iwylight13

@rcarmichael, check the IKEA RGB and RGBW bulbs zigbee DHs in the SmartThings Github repo, you will might find what you are looking for.

But otherwise, isn’t your Mi Light Bulb supported already by the Mi Connector?

Thanks for your reply, @GSzabados,
Unfortunately the ikea bulbs don’t use the same color logic.
“Mi Light” is different to the Xiamoi Mi Light (confussing!); it is controlled with UDP.

Drop a message in the topic, @fison67 might have something for that bulb as well.

Have you looked at these topics?

Yes; unfortunately they only seem to reference the 16 incrementals… I’m looking to fill it out to all 255 colors.

Does it make any sense for you?

LimitlessLED RGBW bulbs can represent only the hue component of RGB color. There are 256 possible values, starting with blue as 0. Maximum saturation and value are always used. This means that most RGB colors are not supported. There are two special cases: Black (0, 0, 0) is simply all LEDs turned off. White (255, 255, 255) is the RGB LEDs off and the white LED on. Note that the actual color of the white LED depends on whether the bulb is a cool white or a warm white bulb.

Thanks @GSzabados,
A little… it seems I need to go through and type out 255 individual entries; will take a while, but will work (I think, lol!)

You are welcome. Honestly, I thought of that,but didn’t mean to mention as it is a bit dull idea.

Thats what I ended up doing; if anyone else is looking to do the same, my code is here:
https://github.com/racarmichael/MiLight/blob/master/MiLight_AR_Bulb

1 Like