From: rtrimana Date: Mon, 5 Aug 2019 19:36:26 +0000 (-0700) Subject: Fixing a bug in color control. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fe6e21b5cf890457c499d55ee0abf070f6689c34;p=smartthings-infrastructure.git Fixing a bug in color control. --- diff --git a/ColorControl/ColorControl.groovy b/ColorControl/ColorControl.groovy index c60afb1..a65afbb 100644 --- a/ColorControl/ColorControl.groovy +++ b/ColorControl/ColorControl.groovy @@ -150,24 +150,24 @@ public class ColorControl { } } - def on(String currentSwitch) { - if (currentSwitch != this.currentSwitch) { + def on() { + if (this.currentSwitch != "on") { this.currentSwitch = currentSwitch - println("The light is changed to $currentSwitch!") - sendEvent([name: "switch", value: "$currentSwitch", deviceId: this.id, descriptionText: "", + println("The light is changed to on!") + sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) - sendEvent([name: "switch.on", value: "$currentSwitch", deviceId: this.id, descriptionText: "", + sendEvent([name: "switch.on", value: "on", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } } - def off(String currentSwitch) { - if (currentSwitch != this.currentSwitch) { + def off() { + if (this.currentSwitch != "off") { this.currentSwitch = currentSwitch - println("The light is changed to $currentSwitch!") - sendEvent([name: "switch", value: "$currentSwitch", deviceId: this.id, descriptionText: "", + println("The light is changed to off!") + sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) - sendEvent([name: "switch.off", value: "$currentSwitch", deviceId: this.id, descriptionText: "", + sendEvent([name: "switch.off", value: "off", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } }