From 74a35eeddb9a6d4f4dcef6acddab315129c610e9 Mon Sep 17 00:00:00 2001 From: juano2310 Date: Tue, 30 May 2017 17:50:09 -0400 Subject: [PATCH] ICP-1124 - Sylvania SMART BR30 RGBW ' s color ticker moving randomly state overwrite: true --- .../zigbee-rgbw-bulb.groovy | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy index aa2cd02..b921432 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -103,12 +103,12 @@ def parse(String description) { if (zigbeeMap?.clusterInt == COLOR_CONTROL_CLUSTER) { if(zigbeeMap.attrInt == ATTRIBUTE_HUE){ //Hue Attribute - def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) - sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed") + state.hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) + runIn(5, updateColor, [overwrite: true]) } else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute - def saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) - sendEvent(name: "saturation", value: saturationValue, descriptionText: "Color has changed", displayed: false) + state.saturationValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 0xfe * 100) + runIn(5, updateColor, [overwrite: true]) } } else if (cluster && cluster.clusterId == 0x0006 && cluster.command == 0x07) { @@ -127,6 +127,11 @@ def parse(String description) { } } +def updateColor() { + sendEvent(name: "hue", value: state.hueValue, descriptionText: "Color has changed") + sendEvent(name: "saturation", value: state.saturationValue, descriptionText: "Color has changed", displayed: false) +} + def on() { zigbee.on() } @@ -204,9 +209,9 @@ def setColor(value){ log.trace "setColor($value)" zigbee.on() + zigbee.command(COLOR_CONTROL_CLUSTER, MOVE_TO_HUE_AND_SATURATION_COMMAND, - getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") + - zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + - zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + getScaledHue(value.hue), getScaledSaturation(value.saturation), "0000") + + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) } def setHue(value) {