From fe6e21b5cf890457c499d55ee0abf070f6689c34 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Mon, 5 Aug 2019 12:36:26 -0700 Subject: [PATCH 1/1] Fixing a bug in color control. --- ColorControl/ColorControl.groovy | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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"}']) } } -- 2.34.1