}
}
- 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: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- sendEvent([name: "switch.on", 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"}'])
}
}
- 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: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- sendEvent([name: "switch.off", 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"}'])
}
}