private String label
private String displayName
private String contactState
+ private String currentContact
private String latestValue
+ private String alarmState
+
- ContactSensor(String id, String label, String displayName, String contactState, String latestValue) {
+ ContactSensor(String id, String label, String displayName, String contactState, String currentContact, String alarmState, String latestValue) {
this.id = id
this.label = label
this.displayName = displayName
this.contactState = contactState
+ this.currentContact = currentContact
this.latestValue = latestValue
+ this.alarmState = alarmState
}
def setValue(String value) {
this.latestValue = contactState
println("the contact sensor with id:$id is triggered to $value!")
this.contactState = value
+ this.currentContact = value
+ }
+
+ def on() {
+ println("the contact sensor with id:$id is armed!")
+ this.alarmState = "armed"
+ }
+
+ def off() {
+ println("the contact sensor with id:$id is not armed!")
+ this.alarmState = "not armed"
}
def currentValue(String deviceFeature) {