Set color for HM-LC-RGBW-WM

Hi @all,

I’am new at OpenHAB and would like to implement the Homematic device HM-LC-RGBW-WM (LED Controller). The Problem is, that the LED controller can only receive integer from 0 to 200. So now, I haven’t an idea how I can implement a Transformation from HSBtype to integer 0-200. :frowning:
I have already tested some rules to convert HSBtype to RGB. But no solution for this controller.

Thanks in advance for your help/ideas!
Peter

  • Platform information:
    • Hardware: VM on Hyper-V
    • OS: Ubuntu 10/17
    • openHAB version: 2.0.0-1 (stable release)

Maybe this can help you:

Hi,

I have already read your tutorial. :slight_smile: But I always receive the error that the item aacc_color_r does not exists. :frowning:
And my other question is, how is it possible to calculate a number from 0-255 from the three Content of variables red, green, blue?
I Need the Color value in the HSV-format…

Peter

hi peter,

this is my rule to convert my Color-item to RGB and HSB/V
the only thing i didnt get correct, is the HSB Value in one String ( eg. 100/100/50 )
but i get each single value - maybe this helps

my items:

Color  LED_1_color         "LED 1 Farbe [%.0f]"  {channel="wifiled:wifiled:XXXXXXXXXXXX:color"}

Number LED_1_color_R        "ROT [%.0f]"              <hue>                    
Number LED_1_color_G        "GRÜN [%.0f]"             <hue>                    
Number LED_1_color_B        "BLAU [%.0f]"             <hue>                      
String LED_1_color_RGB      "RGB [%s]"                <list>                      

Number LED_1_color_hue      "Hue [%s]"                <hue>
Number LED_1_color_sat      "Saturation [%s]"         <hue>
Number LED_1_color_bright   "Brightness [%s]"         <hue>
Number LED_1_color_HSB      "HSB [%s]"                <list>
import org.openhab.core.library.types.*

////////////////////////////
// LED RGB & HSB Values
////////////////////////////

var String RGBvalues
var String HSBvalues

rule "Set RGB LEDs from Color item using ColorPicker"
  when
    Item LED_1_color received command
  then
	val red = (LED_1_color.state as HSBType).red * 2.55
	val green = (LED_1_color.state as HSBType).green * 2.55
	val blue = (LED_1_color.state as HSBType).blue * 2.55
  var hue = (LED_1_color.state as HSBType).getHue
  var sat = (LED_1_color.state as HSBType).getSaturation
  var b = (LED_1_color.state as HSBType).getBrightness
  logInfo("LED_RGB_Values.rules", "R:" + red + " G:" + green + " B:" + blue)
  logInfo("LED_RGB_Values.rules", "H:" + hue + " S:" + sat + " B:" + b)

  	LED_1_color_R.sendCommand(red)
  	LED_1_color_G.sendCommand(green)
  	LED_1_color_B.sendCommand(blue)
    RGBvalues = red.toString + " / " + green.toString + " / " + blue.toString
    LED_1_color_RGB.sendCommand(RGBvalues)

    LED_1_color_hue.sendCommand(hue)
  	LED_1_color_sat.sendCommand(sat)
  	LED_1_color_bright.sendCommand(b)
    HSBvalues = hue.State.toString + " / " + sat.State.toString + " / " + b.State.toString
    LED_1_color_HSB.postUpdate(HSBvalues)
end

Thank you so much for your tipps/Solutions. I had a mistake! I don’t need RGB values. I need HSV-values for the Homematic LED controller. So I understand, thats the same as HSBtype. In this case I only need a calculation from HSBtype.Hue to a value from 0-200. Is that possible?

Peter

Hey,

hope its not too late

I’m using this

        var h = hsbValue.hue
	var DecimalFormat df = new DecimalFormat("#.#")
	var dVal = df.format(h)
	var res =  200 * (new DecimalType(dVal)/360)

Hello Peter,
I have at the moment the same problem with HM-LC-RGBW-WM.
Did you get it running by setting the RGBW string. And if yes how?

Oliver

P.S.
Channel Print in Homegear look like this:

MASTER
{
        Channel: 3
        {
                [COLOR_CHANGE_SPEED]: 0a
                [AES_ACTIVE]: 00
        }
        Channel: 2
        {
                [WHITE_ADJUSTMENT_VALUE_RED]: 64
                [WHITE_ADJUSTMENT_VALUE_GREEN]: 64
                [WHITE_ADJUSTMENT_VALUE_BLUE]: 64
                [AES_ACTIVE]: 00
        }
        Channel: 1
        {
                [AES_ACTIVE]: 00
        }
        Channel: 0
        {
                [INTERNAL_KEYS_VISIBLE]: 01
                [POLLING]: 00
                [ROAMING]: 00
                [POLLING_INTERVAL]: 3c
                [LOCAL_RESET_DISABLE]: 00
        }
}

VALUES
{
        Channel: 3
        {
                [USER_PROGRAM]: 00
        }
        Channel: 2
        {
                [USER_COLOR]: 31 39 2e 36 30 37 38 34 33 20 2f 20 31 39 2e 36 30 37 38 34 33 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 20 2f 20 31 39 2e 36 30 37 38 34 33 30 30 30 30 30 30
        }
        Channel: 0
        {
                [DEVICE_IN_BOOTLOADER]: 00
                [CENTRAL_ADDRESS_SPOOFED]: 00
                [RSSI_PEER]: 00
                [AES_KEY]: 00
                [CONFIG_PENDING]: 00
                [LAST_PACKET_RECEIVED]: 5c 64 61 35
                [DUTYCYCLE]: 00
                [UNREACH]: 00
                [LOWBAT]: 00
                [UPDATE_PENDING]: 00
                [RSSI_DEVICE]: 31
                [STICKY_UNREACH]: 00
        }
}

LINK
{
        Channel: 3
        {
                Address: 0x4b5409
                {
                        Remote channel: 3
                        {
                                [SHORT_ACT_MIN_BOARDER]: ff
                                [SHORT_ACT_MAX_BOARDER]: 00
                                [LONG_ACT_MIN_BOARDER]: ff
                                [LONG_ACT_COLOR_PROGRAM]: fe
                                [SHORT_ACT_COLOR_PROGRAM]: fd
                                [LONG_ACT_MAX_BOARDER]: 00
                        }
                }
        }
        Channel: 2
        {
                Address: 0x4b5409
                {
                        Remote channel: 2
                        {
                                [SHORT_ACT_HSV_COLOR_VALUE]: fd
                                [LONG_ACT_HSV_COLOR_VALUE]: fe
                        }
                }
        }
        Channel: 1
        {
                Address: 0x4b5409
                {
                        Remote channel: 1
                        {
                                [UI_HINT]: 00
                                [SHORT_RAMP_START_STEP]: 0a
                                [SHORT_RAMPON_TIME]: 05
                                [SHORT_RAMPOFF_TIME]: 05
                                [SHORT_ON_TIME]: ff
                                [SHORT_ONDELAY_TIME]: 00
                                [SHORT_OFF_TIME_MODE]: 00
                                [SHORT_OFF_TIME]: ff
                                [SHORT_OFF_LEVEL]: 00
                                [SHORT_OFFDELAY_NEWTIME]: 04
                                [SHORT_OFFDELAY_BLINK]: 01
                                [SHORT_JT_RAMPON]: 03
                                [SHORT_JT_ON]: 04
                                [SHORT_JT_OFFDELAY]: 05
                                [SHORT_DIM_STEP]: 0a
                                [SHORT_DIM_MAX_LEVEL]: c8
                                [LONG_JT_RAMPOFF]: 06
                                [LONG_OFFDELAY_OLDTIME]: 04
                                [LONG_JT_RAMPON]: 03
                                [LONG_RAMPON_TIME]: 05
                                [LONG_OFF_LEVEL]: 00
                                [LONG_OFFDELAY_BLINK]: 01
                                [SHORT_ON_TIME_MODE]: 00
                                [LONG_JT_ON]: 04
                                [LONG_ON_TIME]: ff
                                [LONG_JT_OFF]: 01
                                [SHORT_JT_ONDELAY]: 02
                                [LONG_MULTIEXECUTE]: 01
                                [LONG_CT_ON]: 00
                                [LONG_DIM_MIN_LEVEL]: 00
                                [LONG_OFF_TIME]: ff
                                [SHORT_ON_LEVEL_PRIO]: 00
                                [LONG_COND_VALUE_LO]: 32
                                [LONG_CT_OFFDELAY]: 00
                                [SHORT_OFFDELAY_STEP]: 0a
                                [LONG_OFFDELAY_TIME]: 00
                                [SHORT_ON_LEVEL]: c8
                                [SHORT_COND_VALUE_LO]: 32
                                [SHORT_OFFDELAY_TIME]: 00
                                [SHORT_CT_OFF]: 00
                                [LONG_DIM_STEP]: 0a
                                [LONG_COND_VALUE_HI]: 64
                                [SHORT_ON_MIN_LEVEL]: 14
                                [SHORT_CT_RAMPON]: 00
                                [SHORT_OFFDELAY_OLDTIME]: 04
                                [LONG_DIM_MAX_LEVEL]: c8
                                [SHORT_CT_ONDELAY]: 00
                                [LONG_ACTION_TYPE]: 06
                                [SHORT_DIM_MIN_LEVEL]: 00
                                [SHORT_CT_OFFDELAY]: 00
                                [LONG_CT_ONDELAY]: 00
                                [SHORT_CT_ON]: 00
                                [LONG_JT_OFFDELAY]: 05
                                [LONG_OFFDELAY_STEP]: 0a
                                [LONG_CT_RAMPOFF]: 00
                                [LONG_ON_TIME_MODE]: 00
                                [LONG_RAMP_START_STEP]: 0a
                                [SHORT_JT_OFF]: 01
                                [LONG_CT_OFF]: 00
                                [LONG_OFF_TIME_MODE]: 00
                                [SHORT_CT_RAMPOFF]: 00
                                [SHORT_JT_RAMPOFF]: 06
                                [LONG_JT_ONDELAY]: 02
                                [LONG_ONDELAY_MODE]: 00
                                [LONG_ONDELAY_TIME]: 00
                                [LONG_ON_LEVEL_PRIO]: 00
                                [SHORT_ONDELAY_MODE]: 00
                                [LONG_CT_RAMPON]: 00
                                [LONG_ON_MIN_LEVEL]: 14
                                [LONG_RAMPOFF_TIME]: 05
                                [LONG_OFFDELAY_NEWTIME]: 04
                                [LONG_ON_LEVEL]: c8
                                [SHORT_ACTION_TYPE]: 01
                                [SHORT_COND_VALUE_HI]: 64
                        }
                }
        }
}