From 5f72c4e3782d3f32ad5a0edd9dea8d5b1cdc87d4 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Fri, 28 Feb 2020 14:24:35 -0800 Subject: [PATCH] Fixing a bug: for some reason the variable local in setColor() becomes a write-only value that can't be read from. --- SwitchLevel/SwitchLevel.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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: "", -- 2.34.1