Fixing a bug: for some reason the variable local in setColor() becomes a write-only...
authorrtrimana <rtrimana@uci.edu>
Fri, 28 Feb 2020 22:24:35 +0000 (14:24 -0800)
committerrtrimana <rtrimana@uci.edu>
Fri, 28 Feb 2020 22:24:35 +0000 (14:24 -0800)
SwitchLevel/SwitchLevel.groovy

index ea2e122b5f4a157344cd7bb98569b4f9afa2e6be..97affc0dbfc31bebfc975d55bafd8ddeb1410337 100644 (file)
@@ -39,8 +39,8 @@ public class SwitchLevel {
                        this.rate = metaData["level"]
                        this.hue = metaData["hue"]
                        this.saturation = metaData["saturation"]
                        this.rate = metaData["level"]
                        this.hue = metaData["hue"]
                        this.saturation = metaData["saturation"]
-                       println("the switch with id:$id is setted to level $level and hue to $hue and saturation to $saturation!")
-                       sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
+                       println("the switch with id:$id is setted to level ${this.currentLevel} and hue to $hue and saturation to $saturation!")
+                       sendEvent([name: "level", value: "${this.currentLevel}", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        sendEvent([name: "hue", value: "$hue", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                        sendEvent([name: "hue", value: "$hue", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
@@ -56,7 +56,7 @@ public class SwitchLevel {
 
        def setLevel(int level) {
                if (this.currentLevel != level) {
 
        def setLevel(int level) {
                if (this.currentLevel != level) {
-                       println("the switch with id:$id is setted to level $level!")
+                       println("the switch with id:$id is setted to level integer $level!")
                        this.currentLevel = level
                        this.rate = level
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
                        this.currentLevel = level
                        this.rate = level
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
@@ -66,7 +66,7 @@ public class SwitchLevel {
        
        def setLevel(long level) {
                if (this.currentLevel != level) {
        
        def setLevel(long level) {
                if (this.currentLevel != level) {
-                       println("the switch with id:$id is setted to level $level!")
+                       println("the switch with id:$id is setted to level long $level!")
                        this.currentLevel = level
                        this.rate = level
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
                        this.currentLevel = level
                        this.rate = level
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",