Adding missing methods and condition.
[smartthings-infrastructure.git] / ColorControl / ColorControl.groovy
index 4878c48b9f82c55e43a105068269d29e1b6f02dc..c3d652d1e8aa85090c56c75dcb2d564b368b26b6 100644 (file)
@@ -142,6 +142,16 @@ public class ColorControl {
                }
        }
 
+       def setLevel(long level) {
+               if (level != this.level) {
+                       this.currentLevel = level
+                       this.level = level
+                       println("The level of the light is changed to $level!")
+                       sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
+                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+               }
+       }
+
        def setColorTemperature(int colorTemperature) {
                if (colorTemperature != this.colorTemperature) {
                        this.colorTemperature = colorTemperature