i have a custom device handler that had color options .. i use it as a switch that also has color options to pass through to my hue lights.. there is supposed to be a color panel to pick a color (at least there was in older firmwares) under the set color button..
i am ok with that but will need documentaiton on how to use the new functdionality to rewrite it..
What's driver code? No need to post/send the entire driver, just the relevant bits.
here is code but be loosing my mind.. guess it hasnt worked for awhile.. how can i add a color selection control to the device handler so i can pass it through.. thanks for the help
def setColor(value) {
if (logEnable) log.debug "setColor: ${value}, $this"
if (value.hue) { sendEvent(name: "hue", value: value.hue)}
if (value.saturation) { sendEvent(name: "saturation", value: value.saturation)}
if (value.hex) { sendEvent(name: "color", value: value.hex)}
if (value.level) { sendEvent(name: "level", value: value.level)}
}
def setAdjustedColor(value) {
if (value) {
if (logEnable) log.trace "setAdjustedColor: ${value}"
def adjusted = value + [:]
adjusted.hue = adjustOutgoingHue(value.hue)
// Needed because color picker always sends 100
adjusted.level = null
setColor(adjusted)
}
}
\
Have a look at the rgbw sample driver in our public repo.
1 Like
If it's the driver in your public repo, hubitat/advzwavedimmerlgkv2.groovy at master · lgkahn/hubitat · GitHub, it looks like you're doing capability "ColorControl"
and specifying a custom command "setColor
". One or the other should be sufficient, but the latter would also need a parameter of type COLOR_MAP
specified (which I'm surprised ever displayed as you expected without it, given that I'd expect the custom command declaration to override the standard capability command, but perhaps that only happened under certain circumstances). I'd probably go with the former, both because it's easier and because apps that look for the capability will see it.
What I don't know is if you also want a color map for your truly custom setAdjustedColor()
command whether the UI lets you have two driver inputs with type COLOR_MAP
at the moment. This used to not work, perhas due to a bug or some design decision, but I haven't tested in 2.3.1. But I wouldn't expect that command to have ever had a color picker, so I assume it's not what you're talking about.
Also, there's some excess SmartThings code for tiles and whatnot in that code, which I'd probably remove on Hubitat, but wouldn't be causing this problem. 
thank you i removed the tile stuff and removed the custom command and as you said it just started working magically..
1 Like