this.label = label
this.displayName = displayName
this.doorState = doorState
+ this.doorLatestValue = doorLatestValue
}
//By Apps
def open() {
if (doorState != "open") {
println("the door with id:$id is open!")
- this.doorLatestValue = this.doorState
+ this.doorLatestValue = "open"
this.doorState = "open"
sendEvent([name: "doorControl", value: "open", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
if (doorState != "open") {
def task = timers.runAfter(metaData["delay"]) {
println("the door with id:$id is open!")
- this.doorLatestValue = this.doorState
+ this.doorLatestValue = "open"
this.doorState = "open"
sendEvent([name: "doorControl", value: "open", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
def close() {
if (doorState != "closed") {
println("the door with id:$id is closed!")
- this.doorLatestValue = this.doorState
+ this.doorLatestValue = "closed"
this.doorState = "closed"
sendEvent([name: "doorControl", value: "closed", deviceId: this.id, descriptionText: "",
displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
if (doorState != "closed") {
def task = timers.runAfter(metaData["delay"]) {
println("the door with id:$id is closed!")
- this.doorLatestValue = this.doorState
+ this.doorLatestValue = "closed"
this.doorState = "closed"
sendEvent([name: "doorControl", value: "closed", 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.doorLatestValue = this.doorState
+ this.doorLatestValue = value
this.doorState = value
}