From: rtrimana Date: Fri, 28 Feb 2020 22:24:35 +0000 (-0800) Subject: Fixing a bug: for some reason the variable local in setColor() becomes a write-only... X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=commitdiff_plain;h=5f72c4e3782d3f32ad5a0edd9dea8d5b1cdc87d4 Fixing a bug: for some reason the variable local in setColor() becomes a write-only value that can't be read from. --- diff --git a/SwitchLevel/SwitchLevel.groovy b/SwitchLevel/SwitchLevel.groovy index ea2e122..97affc0 100644 --- a/SwitchLevel/SwitchLevel.groovy +++ b/SwitchLevel/SwitchLevel.groovy @@ -39,8 +39,8 @@ public class SwitchLevel { 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"}']) @@ -56,7 +56,7 @@ public class SwitchLevel { 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: "", @@ -66,7 +66,7 @@ public class SwitchLevel { 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: "",