webCoRE - Piston setColor not working

I’ve had a play around and I’ve got most things working but device->setColor just doesn’t want to work. I’ve tried many options e.g. using a value #00ff00 and even assigning the last colour value to a variable, echoing it to the console (displays the correct hex value) then writing it back to the device using setColor

I am using my own device and device handler, but it does use the standard SmartThings color commands.

The other problem I have is I can’t debug exactly what is being sent to the device (via HTTP) as when commands are fired from a piston they don’t appear in the event log. If I fire the events from a routine, they do.

Any ideas why color isn’t working, or why my device handler doesn’t output any debug info when fired from a piston?

Enable full logs from webCoRE - does it say it’s skipping because it wouldn’t change anything? If so, disable command optimizations in the piston settings. Is your DTH correctly updating it’s attributes when it receives commands?

it says…

Executed physical command [Mood Lighting].setColor([[hex:#00ff00, hue:33, saturation:100, level:50]]) (1470ms)

My device handler expects…

def setColor(value) {
log.debug "Executing ‘setColor’ ${value.hex}"
sendToParticle(“fadeRgb”,value.red + “,” + value.green + “,” + value.blue + “,200”)
sendEvent(name: “color”, value: value.hex)

}

I still don’t get “Executing ‘setColor’…” in the log, but I’m guessing .red,.green, .blue arn’t set

Then perhaps you’re not using the standard color commands.

http://docs.smartthings.com/en/latest/capabilities-reference.html#color-control

You need to expect a Map, one of the values can be hex where you’ll find the rgb hex code. They removed the hex parameter from the docs but it still exists.

I’ve rewritten it to use .hex instead of .red .green .blue. However these are the variables that the standard ST colorpicker tile returns. I give up with the ST docs, half the time their own references don’t match the examples provided.

It’s working now though, I’ll update to use H,S at some point but just trying out a few things with this piston first.

Don’t suppose there’s a better way to temporarily change a device state? At the moment I’m assigning variables for each device and each param, then setting them to what I want, then after a delay, setting them to the variables.