Changing color of Hue bulbs


(John Magrane) #1

Has anyone had success changing the color of a Hue bulb from within a smart app? I can turn the bulbs on and off with no problem but using the setHue and setSaturation commands doesn’t seem to do anything. The values in the device list change, but the color of the bulb is the same. What am I missing?

Thanks for any help


(Jason J) #2

Ditto… I haven’t tried this yet, but am interested as well. I want to setup a nightlight app that will set the color of my hue bulbs to blue during the night, and set the brightness level. Quick check of the example apps and I didn’t see any Hue code to use as a starting point. Anybody who has done this and can point me toward some code would be a big help! - thanks…


(Jason J) #3

After searching a bit more, looks like similar thread here: http://build.smartthings.com/forums/topic/set-the-color-on-hue/

John - I haven’t had time to try and write any of my own code, are these the commands you are trying? Perhaps if you posted your code somebody can point out the error…


(John Magrane) #4

Hi Jason,
I was working on my code yesterday and got it working. With all the changes I made, I’m not sure what I did wrong but the code below is working. What I did find is that the Philips documentation lists hue values of 0 to ~65000 and and saturation of 0 to 255 Smartthings seems to map both values to 0 to 99. It might have been that I was just using hue values over 99 and the all got limited to the same color.

preferences {
section(“When there’s movement…”) {
input “motionSensor”, “capability.motionSensor”, title: “Where?”, multiple: true
}
section (“Control these lights…”) {
input “hueLights”, “capability.switch”, multiple: true
}
}
.
.
.
.
.
def motionActiveHandler(evt) {
if (!state.bedroomLights) {
if (correctMode() && correctTime()) {
hueLights.setLevel(99)
hueLights.setSaturation(59)
hueLights.setHue(14)
hueLights.on()
}
}
else {
unschedule(motionCheck)

John
}
}


(Jason J) #5

nice, thanks for posting the code! I hope to work on mine this weekend…