How can I send a color as command?

Hey,

How can I send a HSBType with sendCommand?

As example Item1.sendCommand(360,1,1) does not work.

Thanks

See Type Conversions for some details.

But I think just putting the argument in quotes will work in this case:

sendCommand("360,1,1") // note the removed spaces

If not perhaps passing the arguments to an HSBType will work

sendCommand(new HSBType(new DecimalType(360), new PercentType(1), new PercentType(1)))
1 Like

Thank you, not it ist possible to switch the stripe on with the specified color.

But I have two Items, the first goes to channel dimmer on the second to the color. Now I expect if I set a color, that the dimmer will be updated but it is still at 0%. Can anybody tell my why?

Switch LED_Kueche_Light_Switch "LED Streifen Küche An/Aus"
Dimmer LED_Kueche_Light_Dimmer "LED Streifen Küche" {channel="zwave:device:de7d553e:node2:switch_dimmer"}
Color  LED_Kueche_Light_Color  "LED Streifen Küche Farbe" {channel="zwave:device:de7d553e:node2:color_color"}
rule "LED_Kueche_Light_ON"
when
    Item LED_Kueche_Light_Switch changed to ON
then
    LED_Kueche_Light_Color.sendCommand("55,80,50")
end

rule "LED_Kueche_Light_OFF"
when
    Item LED_Kueche_Light_Switch changed to OFF
then
    LED_Kueche_Light_Dimmer.sendCommand(OFF)
end

Not sure that it is designed to work like that. It is unclear to what level the dimmer (dimmer values can be any number between 0 and 100) should be set, just because the color changed.
If you add to your first rule just below the line with the color command LED_Kueche_Light_Dimmer.sendCommand(ON) your rule switch on the LED light with the color you set in the command before. Please note that ON translates to 100 (max brightness) so pick another value if this is too bright.

Thank you, but now if I set color to “45,75,0” and after that I sendCommand(50) to the dimmer channel I get a different color.

Not sure why this happens, maybe you have to look into the documentation of your devices.
As a work-around, maybe send the color command after the dimmer command. If you still don’t like the color, just play with the values until it does what you want.

Hello Community,

I am making loop to increase color brightness gradually using design pattern timer loop created by @rlkoshak , thank you,

And I have a couple of questions:
1- Is it better to use Type.valueOf instead of new Type to avoid creating new objects in looping, as here

RGBW_Color.sendCommand(new HSBType(DecimalType.valueOf(lstColors.get(triggeringItem.getName)), PercentType.valueOf(dimValue.toString), PercentType.valueOf(dimValue.toString)))

instead of

RGBW_Color.sendCommand(new HSBType(new DecimalType(lstColors.get(triggeringItem.getName)), new PercentType(dimValue.toString), new PercentType(dimValue.toString)))

2- Which is the better way to increase color brightness and turn off color: by sending command to RGBW_SwitchDimmer item, or changing saturation and brightness of RGBW_Color item ?