Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authorrtrimana <rtrimana@uci.edu>
Mon, 5 Aug 2019 19:36:38 +0000 (12:36 -0700)
committerrtrimana <rtrimana@uci.edu>
Mon, 5 Aug 2019 19:36:38 +0000 (12:36 -0700)
ColorControl/ColorControl.groovy

index c60afb1620e7cbec1bbe659f4e6cbd20b2db40ef..a65afbb78e2630ccdf969b096c611a08cf1335f1 100644 (file)
@@ -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"}'])
                }
        }