def lock() {
if (lockState != "locked") {
println("the door with id:$id is locked!")
- this.lockLatestValue = this.lockState
+ this.lockLatestValue = "locked"
this.lockState = "locked"
this.currentLock = "locked"
sendEvent([name: "lock", value: "locked", deviceId: this.id, descriptionText: "",
if (lockState != "locked") {
def task = timers.runAfter(metaData["delay"]) {
println("the door with id:$id is locked!")
- this.lockLatestValue = this.lockState
+ this.lockLatestValue = "locked"
this.lockState = "locked"
this.currentLock = "locked"
sendEvent([name: "lock", value: "locked", deviceId: this.id, descriptionText: "",
def unlock() {
if (lockState != "unlocked") {
println("the door with id:$id is unlocked!")
- this.lockLatestValue = this.lockState
+ this.lockLatestValue = "unlocked"
this.lockState = "unlocked"
this.currentLock = "unlocked"
- sendEvent([name: "unlock", value: "unlocked", deviceId: this.id, descriptionText: "",
+ sendEvent([name: "lock", value: "unlocked", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
if (lockState != "unlocked") {
def task = timers.runAfter(metaData["delay"]) {
println("the door with id:$id is locked!")
- this.lockLatestValue = this.lockState
- this.lockState = "locked"
- this.currentLock = "locked"
- sendEvent([name: "unlock", value: "unlocked", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ this.lockLatestValue = "unlocked"
+ this.lockState = "unlocked"
+ this.currentLock = "unlocked"
+ sendEvent([name: "lock", value: "unlocked", deviceId: this.id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}
}
//By Model Checker
def setValue(String value) {
println("the door with id:$id is $value!")
- this.lockLatestValue = this.lockState
+ this.lockLatestValue = value
this.lockState = value
this.currentLock = value
}