SOLVED: NULL Command Argument Error when Sending RGB to Color Item or Group

I cannot tell if this is a command parsing bug, or incorrect syntax. I’m trying to sending RGB to a Z-Wave Item Bulb (Group example below) in OH2.

I’ve searched high and low, I’ve reviewed the DEBUG log when using the Color Picker. I cannot for the life of me get this command correct.

[ERROR] [.script.engine.ScriptExecutionThread] - Error during the execution of rule 'Color Testing': The argument 'command' must not be null or empty.

rule "Color Testing"
        Item sTest changed to 10

        logInfo("ColorTesting","Resetting Status")

You’ll help me implement a Pink night light for my 6 year old daughter. :wink:

Please advise.

I don’t think this is the correct syntax… You will need to create an HSBType, and not 3 integers…

I’m not sure of the syntax (I’m not a big user of rules, let alone color lights :slightly_smiling:), but you probably want to look at something along the following lines…

hsb = HSBType.fromRGB(255,0,255) as HSBType
sendCommand(gRGBTest, hsb)

This is no doubt wrong, but maybe it puts you on the right track…

1 Like

@chris - You did indeed get me on the right track!

Turns out I was looking at this through Rose Colored Glasses. The command is expecting color in HSB (Hue, Saturation, Brightness) encoding. I’ve never used HSB, always thinking of colors in RGB as you can tell from the naming of my Group gRGBTest.

I’ve changed my code to be quoted and in the correct HSB type format and now I can do what I want. I think the NULL Command Argument was being thrown because of the lack of quotes.


My daughter will now be enjoying a Pink (“328,92,100”) nightlight.

Thanks, Chris!

Glad it got you there :slightly_smiling:.

You should also be able to use the HSBType.fromRGB to convert if you wanted to use RGB… This is a static method I added when I wrote the COLOR class for Z-Wave - but in case anyone else is reading this, I don’t think it was back-ported to OH1, so it’s only available on OH2…

I’m struggling with similar issue in working to set the color of multiple bulbs at once. I found some past posts on this working in OH1, but struggling to get this to work in OH2.

I think I would prefer if you could just set and control the color of multiple bulbs in a Group, but not sure if that is possible or not. So I’m trying to set them via a rule.

Currently, i’m trying to set the color of 2 Hue bulbs at the same time.

This is my items

Group ColorLight <light>

Color  ColorGroup "Color Group" (mColorGroup, ColorLight)
Dimmer Hue1Light "Hue 1 Light" <slider>                    {channel="hue:LCT007:00178817d7ef:9:brightness"}
Dimmer Hue1Temp  "Hue 1 Temp"  <slider>                    {channel="hue:LCT007:00178817d7ef:9:color_temperature"}
Color  Hue1Color "Hue 1 Color" <slider>  (ColorLight)      {channel="hue:LCT007:00178817d7ef:9:color"}

Dimmer Hue2Light "Hue 2 Light" <slider>                    {channel="hue:LCT007:00178817d7ef:10:brightness"}
Dimmer Hue2Temp  "Hue 2 Temp"  <slider>                    {channel="hue:LCT007:00178817d7ef:10:color_temperature"}
Color  Hue2Color "Hue 2 Color" <slider>  (ColorLight)      {channel="hue:LCT007:00178817d7ef:10:color"}

and this is the rule
> rule “Set RGBW Value of each light”
> when
> Item ColorGroup received update
> then
> var color_value = ColorGroup.state as HSBType
> sendCommand(ColorLight,color_value)
> end

Edit. I just learned that if I change the rule to


That will change the color of each bulb. but trying as the Group ColorLight does not want to work. I assume I my rule or item is somewhere incorrect then?

I don’t know if it’s right, but I read in another thread that having two channel links to the device could cause problems (deadlock), so I went away from 3 channels and only have my Color linked now. Color will do Dimmer and Switch functions, so you only need one Channel. I also create my items in a file, so I removed what are your two Dimmer lines for each bulb. Things seem more stable for me. In the group designation, you can send the command to your ColorLight group. The other two don’t seem to have groups defined so they wouldn’t be controllable that way.

Color   Bulb_J_C      "J Bed Rm Clr"        <colorwheel>    (SW_UF_Lights,gKidsLights,gRGB)
Color   Bulb_L_C      "L Bed Rm Clr"        <colorwheel>    (SW_UF_Lights,gKidsLights,gRGB)

So I can send the command to either the Item name (Bulb_BR_C) or Group (gKidsLights).




you can also issue dimmer percentages without the color values. So I dim the lights over time and simply pass the Color Channel items a dimmer number between 99 -1.

                sendCommand(gKidsLights, 40)
                sendCommand(gKidsLights, 20)
                sendCommand(gKidsLights, 5)

Then turn them off with the OFF command.

               `sendCommand(gKidsLights, OFF)`

So the bottom line is that these guys are brilliant @chris, you just have to pass HSB, percents, or ON/OFF to the one channel and it works.

This needs to get blessed and written up in the Wiki because I chased it for the better part of a day.


Thanks for the help, but I still couldn’t get that to work. So currently, I only have this group name and items attempting to control the color of 3 hue bulbs together

Group ColorLight <light>

Color  ColorGroup "Color Group"   (mColorGroup, ColorLight)
Color  Hue1Color   "Hue 1 Color"   <slider> (ColorLight)       {channel="hue:LCT007:00178817d7ef:9:color"}
Color  Hue2Color   "Hue 2 Color"   <slider> (ColorLight)       {channel="hue:LCT007:00178817d7ef:10:color"}
Color  Hue3Color   "Hue 3 Color"   <slider> (ColorLight)       {channel="hue:LCT001:00178817d7ef:3:color"}

and with the rule, I can still set them all to one color if I send the command to each specific item, but trying as a group doesn’t seem to work.

rule "Set RGBW Value of each light"
  Item ColorGroup received update
  var color_value = ColorGroup.state as HSBType

Excellent advice in this thread, It helped me out a lot. Thank you all.

Why are quotes needed? I am trying to use a variable.

val test = 128
sendCommand(Solar, test,100,15)

Got it: sendCommand(Solar, test+",100,15")

1 Like