Rule engine: Set color: Set color by numerical value

Is there a way to use the advanced slider on the Set Color command to use numerical hue: saturation: lightness values? (i.e. What does each argument represent?)

Hi @Chip_Fillingane, you can use setHue and/or setSaturation commands to set the color using the specific numeric value(s).

Normal Hue and Saturation Value Range:

Hue: 0-360
Saturation: 0-100

† SmartThings maps the hue to a range of 0-100. You can use a simple formula to convert standard hue: hue / 360 * 100
   So a blue hue of 240 would be ~67. (240 / 360 * 100 = 66.66)

Here is a quick graphic explanation of HSV model from wiki. Though it may be easier to just use an HSV color picker online or try setting a color on your bulb and then see what SmartThings reports the hue attribute as.

You can play with different colors and find the exact Hue and Saturation value from the SmartThings IDE (or by viewing the device details in SharpTools) that you can use in the commands.

Say you were going to do this like 100 times about 1 minute apart. Is there any way to only type 100 commands, as opposed to 200 commands?

You can also tap the “Advanced” switch at the top-right corner of the action and change `setColor’'s argument from Color_map to JSON.

JSON value example → {"hue": 30, "saturation": 100}

That’s what I was looking for. Thanks!

I may be missing the ping here but I am wanting to do something simple. What is the hue & Saturation for “white”, “red”, “green”, “yellow”, etc.

Or put another way how do I set color by simply using the name like “white” or “red”?



Hi Joe, welcome to the community! This post was in the context of specifically wanting to set things by numerical value. If you just want to set a normal color, is there something about the color picker from the setColor() command that doesn’t work for you?

Thanks for the quick reply!!!

I cannot find white using the device you illustrated.


That does seem to be a bit of a usability gap with the color picker on the Rule Engine compared to that of the dashboard. I’ve noted the feedback.

Long story short, you can adjust the second slider all the way to left for white. That being said, if your bulb also supports color temperature, I would suggest using the setColorTemperature() command as it will produce a more natural ‘white’ that you’re probably used to with regular bulbs.

2700K being a warm white (amber hues), 3500K being a bit cooler/whiter, and beyond 4000K starting to get into cooler/bluish hue of white.

For comparison, in the dashboard color ‘wheel’, you reduce the saturation as you get closer to the center of the wheel which brings you closer to white. In the Rule Engine color sliders, as you reduce the second slider it reduces the saturation but the slider should probably be updated to show that you move toward white rather than gray.


I’ve bubbled through it and have a rule to set a bulb red and one to set it white via the color picker.

Having said that, I want to set the color by a variable i.e. $colorred, $colorwhite

Thanks for your help


Doing it through a single setColor() command with a single variable isn’t officially supported, but I just tried with a few devices and it seems to work. Officially, the setColor() command in SmartThings requires an object as the first parameter with hue, saturation, and optionally level properties.

We have Text, True/False, and Numeric variable types… but notably missing is an ‘Object’ variable type which is why I say it’s not officially supported.

That being said, I tried using a Text variable with the proper object formatting mentioned further up in the thread and to my surprise, it worked… so SmartThings might be doing some special processing of the arguments.

My test rule was just a single setColor() command with my specially formatted variable:

The rest of the details are covered in the notes by James further up in the thread, but if you have specific questions, feel free to ask! :slight_smile:


After talking with a photographer friend who really understands color I came away with these tidbits
1- To set color to white, simply set temperature to 7,000
2- Why are we using HUE/Saturation when most of the color world understands and uses RGB? This is a request for a product enhancement.
3- Further the ability to set color (Red) (Green), (Blue), (white) etc. needs to be added as an enhancement as well.

Thanks for your insight.
Joe Baldwin

That’s certainly one approach. Using setColorTemperature() with a value of 7000K will get you “white”, but so will any other color temperature 2200, 3000, etc. You’ll get different ‘temperatures’ with each though.

Image Credit:

The lighting and smart home industry more commonly uses hue+saturation. Keep in mind that this isn’t something that SharpTools has defined… these commands are coming from your smart home platform and it defines the commands and the parameters it accepts.

I would note that there are several different color standards and each industry tends to use different standards. RGB is common in digital design and photo editing, but CMYK, Pantone, HSL, HSV and other standards are used in other spaces.

Feel free to create a feature request. I would go back to the point that the standard approach for setting color in a SharpTools rule is just selecting a color from a color picker, so I’m confused where the problem stems from.

If you don’t want to pick from the color picker and want to manually set a color using numeric inputs, it’s up to your smart home platform what color format it accepts. We could perhaps offer a different input method and then convert it to the appropriate format, but that’s already covered by countless online color format converters. :thinking:

Note that some color strips which offer individual Red, Green, Blue, and White color channels do offer the ability to set the individual colors. Again, this depends on the device and what commands it exposes.

1 Like

Hi Josh, I’m very interested in this topic. The issue I have with the Color Picker is that it’s very difficult to get the exact same color for multiple lights. For example, I have 6 LEDs that I’d like to set to the exact same dark blue color. Using the color picker doesn’t well for this application. Instead, I’d rather use a specific variable/command to define the color. Thanks!

1 Like

That’s certainly achievable as noted in the examples above.

1 Like

Is this the correct syntax? I couldn’t tell about spaces before and/or after the comma that separates hue and saturation.


The spaces shouldn’t matter, but the quotes do. They should be straight quotes, not curly quotes:

  • " = good
  • = bad

And it looks like you have a rogue quote after the hue value. So it should look more like:

1 Like

This didn’t work for me. Any thoughts? Thanks!

What did the Rule Logs show?