def on() {
if (switchState != "on") {
println("the relay switch with id:$id is on!")
- this.switchLatestValue = this.switchState
+ this.switchLatestValue = "on"
this.switchState = "on"
this.currentSwitch = "on"
sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
if (switchState != "on") {
def task = timers.runAfter(metaData["delay"]) {
println("the relay switch with id:$id is on!")
- this.switchLatestValue = this.switchState
+ this.switchLatestValue = "on"
this.switchState = "on"
this.currentSwitch = "on"
sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
def off() {
if (switchState != "off") {
println("the relay switch with id:$id is off!")
- this.switchLatestValue = this.switchState
+ this.switchLatestValue = "off"
this.switchState = "off"
this.currentSwitch = "off"
sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
if (switchState != "off") {
def task = timers.runAfter(metaData["delay"]) {
println("the relay switch with id:$id is off!")
- this.switchLatestValue = this.switchState
+ this.switchLatestValue = "off"
this.switchState = "off"
this.currentSwitch = "off"
sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
//By Model Checker
def setValue(String value) {
println("the relay switch with id:$id is $value!")
- this.switchLatestValue = this.switchState
+ this.switchLatestValue = value
this.switchState = value
this.currentSwitch = value
}