Getting HSB values from Colorpicker

I want to retrieve the HSB values from Colorpicker so that I can utilize them in a rule with executeCommandLine.

Unfortunately I’m not very familiar with Java, and I can’t find any documentation for how the Colorpicker Item’s data is formatted or how to access it.

I want to accomplish something like this (pseudo-code)

rule "Colorpicker Activated"
     Item my_Colorpicker received command
     var Number hColorpicker = [Hue from Colorpicker] * 65535/[Colorpicker max Hue value]
     var Number sColorpicker = [Sat from Colorpicker] * 65535/[Colorpicker max Sat value]
     var Number bColorpicker = [Bright from Colorpicker] * 65535/[Colorpicker max Bright value]

Can someone help me write this properly? Thanks!

If you use Designer you can press <ctrl><space> after starting a line and it will give you a dialog on how to complete it. This is the best way to discover the methods available without looking at the code, when you can’t find docs that explain it.

var hue = (my_Colorpicker.state as HSBType).getHue
var sat = (myColorpicker.state as HSBType).getSaturation
var b = (myColorpicker.state as HSBType).getBrightness

The sat and brightness are returned as PercentTypes which means they are limited to be between 0 and 100. Hue returns DecimalType so I don’t know what, if anything would be the maximum allowed hue value. I would go ahead and max it out with the color picker and log the value to see what it is and assume that is the max.

Thanks Rich! Ctrl+space is a great feature, I can’t believe I missed it.

For the record, hue is 0-360 (makes sense as the picker is a color wheel).