From bc817f8530aca1b703b1511a8d9346c082d3ad2d Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Fri, 9 Sep 2016 16:52:52 -0600 Subject: [PATCH] DVCSMP-2024 OSRAM: Hue is incorrectly set to be 0-360 -Hue changed to handle 0-100 according to SmartThings API --- .../osram-lightify-gardenspot-mini-rgb.groovy | 4 ++-- .../osram-lightify-led-flexible-strip-rgbw.groovy | 14 +++++++------- .../zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy b/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy index bc2d7ba..2dc1bf6 100644 --- a/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy +++ b/devicetypes/smartthings/osram-lightify-gardenspot-mini-rgb.src/osram-lightify-gardenspot-mini-rgb.groovy @@ -91,7 +91,7 @@ def parse(String description) { if (descMap.cluster == "0300") { if(descMap.attrId == "0000"){ //Hue Attribute - def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 360) + def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 100) log.debug "Hue value returned is $hueValue" sendEvent(name: "hue", value: hueValue, displayed:false) } @@ -203,7 +203,7 @@ def setLevel(value) { //input Hue Integer values; returns color name for saturation 100% private getColorName(hueValue){ - if(hueValue>360 || hueValue<0) + if(hueValue>100 || hueValue<0) return hueValue = Math.round(hueValue / 100 * 360) diff --git a/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy b/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy index e3d15d1..ef1ff1c 100644 --- a/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy +++ b/devicetypes/smartthings/osram-lightify-led-flexible-strip-rgbw.src/osram-lightify-led-flexible-strip-rgbw.groovy @@ -1,4 +1,4 @@ -/* +/* Osram Flex RGBW Light Strip Osram bulbs have a firmware issue causing it to forget its dimming level when turned off (via commands). Handling @@ -8,7 +8,7 @@ metadata { definition (name: "OSRAM LIGHTIFY LED Flexible Strip RGBW", namespace: "smartthings", author: "SmartThings") { - + capability "Color Temperature" capability "Actuator" capability "Switch" @@ -18,7 +18,7 @@ metadata { capability "Refresh" capability "Sensor" capability "Color Control" - + attribute "colorName", "string" command "setAdjustedColor" @@ -49,7 +49,7 @@ metadata { standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") { state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh" } - + controlTile("colorTempSliderControl", "device.colorTemperature", "slider", height: 1, width: 2, inactiveLabel: false, range:"(2700..6500)") { state "colorTemperature", action:"color temperature.setColorTemperature" } @@ -118,7 +118,7 @@ def parse(String description) { } } else if(descMap.attrId == "0000"){ //Hue Attribute - def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 360) + def hueValue = Math.round(convertHexToInt(descMap.value) / 255 * 100) log.debug "Hue value returned is $hueValue" sendEvent(name: "hue", value: hueValue, displayed:false) } @@ -274,7 +274,7 @@ private getGenericName(value){ //input Hue Integer values; returns color name for saturation 100% private getColorName(hueValue){ - if(hueValue>360 || hueValue<0) + if(hueValue>100 || hueValue<0) return hueValue = Math.round(hueValue / 100 * 360) @@ -449,7 +449,7 @@ def setColor(value){ def level = hex(value.level * 255 / 100) cmd << zigbeeSetLevel(level) } - + if (value.switch == "off") { cmd << "delay 150" cmd << off() 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 e7137b6..b170fc8 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -105,7 +105,7 @@ 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) / 255 * 360) + def hueValue = Math.round(zigbee.convertHexToInt(zigbeeMap.value) / 255 * 100) sendEvent(name: "hue", value: hueValue, descriptionText: "Color has changed") } else if(zigbeeMap.attrInt == ATTRIBUTE_SATURATION){ //Saturation Attribute