Latest Hue state


(Sti Lab) #1

In my groovy script, I am using:

def aClr = device.latestValue('color')
log.debug "Latest Color is: ${device.latestValue('color')}"

but neither latestValue('color') nor currentValue('color') returns me the accurate hex of the hue. What gives?


(Mike Maxwell) #2

Try using hue, saturation and level instead.
The hex color values are mapped into a smaller bit space than the actual hue’s support.
I think this has something to do with the ST color wheel being only 8 bit capable, don’t know for sure.
you can see the conversion gymnastics in the hue connect app.


(Nico) #3

is this about hue status on Smartthings mobile app ?

Because in Smartthings app the status of hue bulb is not always right, especially when we override the lamp from another app, or from physical wall switch.

If we change the state of the lamp from hue app or wall switches, the status on ST app is not updating to the latest condition.

This condition is not good for the ‘peace of mind’ concept, because we can make sure the actual condition of our devices.

Still waiting an update from ST about this issue.


(Sti Lab) #4

Can you explain how getting the level enable me to determine the correct color setting? Is there a way to combine the hue, saturation and level to determine the color?


(Sti Lab) #5

Actually, it is a SmartApp that I wrote.

Unfortunately, even the Philips Hue API would not always give the state accurately. So, I realized that there is not much ST can do unless Philips itself provides some updates.


(Mike Maxwell) #6

hue saturation and level together determine the color, the hex color value is created from those three attributes.
so you use hue,saturation and level or color, but not both.


(Scott G) #7

You can try the link below to see some conversions. Zigbee bulbs don’t incorporate the L (luminance) portion of the color, although you do get some of this through the light’s dim level. (You have to do transformations for both Hue and Saturation as well since the values from the bulb are 0-254. For Hue, it’s (Value*360)/254 = CurrentHue. For Saturation, it’s (Value/254) = CurrentSaturation.

http://www.rapidtables.com/convert/color/hsl-to-rgb.htm