So I am wanting to add Hue control to one of my apps, but the existing hue apps are quite confusing for me. Does anyone have base code for making a hue to red, blue, green, etc? Flashing would be cool too.
Thanks!
So I am wanting to add Hue control to one of my apps, but the existing hue apps are quite confusing for me. Does anyone have base code for making a hue to red, blue, green, etc? Flashing would be cool too.
Thanks!
Unfortunately ‘alert’ and ‘transition time’ are not supported in the device type, so that leaves out flashing and fading.
I have example code that uses Hue API values (0-255 and 0-65535). If that’s ok with you lemmeno and I’ll post it.
Yes @scottinpollock any starting point helps!
The inputs look something like this:
section("Choose light settings...") {
input "hues", "capability.colorControl", title: "Which Hue Bulbs?", required:false, multiple:true
input "color", "number", title: "Hue (0-65535)", required: false, multiple:false
input "saturation", "number", title: "Saturation (0-255)", required: false, multiple:false
input "lightLevel", "number", title: "Brightness (0-255)", required: false, multiple:false
}
And the command is:
private doHUE() {
def saturationInt = saturation / 255 * 100 as Integer
def lightLevelInt = lightLevel / 255 * 100 as Integer
def colorInt = color / 65535 * 100 as Integer
log.debug "${colorInt} ${saturationInt} ${lightLevelInt}"
state.previous = [:]
hues.each {
state.previous[it.id] = [
"switch": it.currentValue("switch"),
"level" : it.currentValue("level"),
"hue": it.currentValue("hue"),
"saturation": it.currentValue("saturation")
]
}
log.debug "current values = $state.previous"
def newValue = [hue: colorInt, saturation: saturationInt, level: lightLevelInt]
log.debug "new value = $newValue"
hues*.setColor(newValue)
}