From a7b0ce57001319af472006cfb44127be9dd176fa Mon Sep 17 00:00:00 2001 From: ZWozniakS Date: Mon, 28 Oct 2019 12:21:34 +0100 Subject: [PATCH 1/2] Added on commands to the setColor() and setColorTemp() --- devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy b/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy index f37d365c0e5..f3295645549 100644 --- a/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy +++ b/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy @@ -240,6 +240,10 @@ def setColor(value) { def rgb = huesatToRGB(value.hue, value.saturation) result << zwave.switchColorV3.switchColorSet(red: rgb[0], green: rgb[1], blue: rgb[2], warmWhite:0, coldWhite:0) } + if (device.currentValue("switch") != "on") { + result << zwave.basicV1.basicSet(value: 0xFF) + result << zwave.switchMultilevelV3.switchMultilevelGet() + } result += queryAllColors() commands(result) @@ -257,7 +261,9 @@ def setColorTemperature(temp) { log.debug "setColorTemperature($temp)" def warmValue = ((COLOR_TEMP_MAX - temp) / COLOR_TEMP_DIFF * 255) as Integer def coldValue = 255 - warmValue - def cmds = [zwave.switchColorV3.switchColorSet(red: 0, green: 0, blue: 0, warmWhite: warmValue, coldWhite: coldValue)] + def cmds = [zwave.switchColorV3.switchColorSet(red: 0, green: 0, blue: 0, warmWhite: warmValue, coldWhite: coldValue), + zwave.basicV1.basicSet(value: 0xFF), + zwave.switchMultilevelV3.switchMultilevelGet()] cmds += queryAllColors() commands(cmds) } From b885ec46da5c3b2e9e4f993d8e1e1ccd1162c883 Mon Sep 17 00:00:00 2001 From: ZWozniakS Date: Wed, 30 Oct 2019 12:49:54 +0100 Subject: [PATCH 2/2] Added condition to the setColorTemp() --- .../smartthings/rgbw-light.src/rgbw-light.groovy | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy b/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy index f3295645549..290d64c4244 100644 --- a/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy +++ b/devicetypes/smartthings/rgbw-light.src/rgbw-light.groovy @@ -261,11 +261,14 @@ def setColorTemperature(temp) { log.debug "setColorTemperature($temp)" def warmValue = ((COLOR_TEMP_MAX - temp) / COLOR_TEMP_DIFF * 255) as Integer def coldValue = 255 - warmValue - def cmds = [zwave.switchColorV3.switchColorSet(red: 0, green: 0, blue: 0, warmWhite: warmValue, coldWhite: coldValue), - zwave.basicV1.basicSet(value: 0xFF), - zwave.switchMultilevelV3.switchMultilevelGet()] - cmds += queryAllColors() - commands(cmds) + def result = [] + result << zwave.switchColorV3.switchColorSet(red: 0, green: 0, blue: 0, warmWhite: warmValue, coldWhite: coldValue) + if (device.currentValue("switch") != "on") { + result << zwave.basicV1.basicSet(value: 0xFF) + result << zwave.switchMultilevelV3.switchMultilevelGet() + } + result += queryAllColors() + commands(result) } private queryAllColors() {