1 //Create a class for contact sensor
3 import Timer.SimulatedTimer
5 public class Contacts {
7 private String displayName
8 private String contactState
9 private String contactLatestValue
11 Contacts(int id, String displayName, String contactState, String contactLatestValue) {
13 this.displayName = displayName
14 this.contactState = contactState
15 this.contactLatestValue = contactLatestValue
18 def setValue(String value) {
19 this.contactLatestValue = contactState
20 println("the contact sensor with id:$id is triggered to $value!")
21 this.contactState = value
24 def currentValue(String deviceFeature) {
25 if (deviceFeature == "contact") {
30 def latestValue(String deviceFeature) {
31 if (deviceFeature == "contact") {
32 return contactLatestValue