Commit #9: extension to the infrastructure with more devices + minor changes in extra...
[smartthings-infrastructure.git] / ContactSensor / ContactSensor.groovy
index f11a325bab8b3fdf414ee00e36b311f03d0ef41b..05e961d5ab0990fa8678e1922c20ec621760638c 100644 (file)
@@ -3,22 +3,22 @@ package ContactSensor
 import Timer.SimulatedTimer
 
 public class ContactSensor {
-       private int id
+       private String id
        private String label
        private String displayName
        private String contactState
-       private String contactLatestValue
+       private String latestValue
 
-       ContactSensor(int id, String label, String displayName, String contactState, String contactLatestValue) {
+       ContactSensor(String id, String label, String displayName, String contactState, String latestValue) {
                this.id = id
                this.label = label
                this.displayName = displayName
                this.contactState = contactState
-               this.contactLatestValue = contactLatestValue
+               this.latestValue = latestValue
        }
 
        def setValue(String value) {
-               this.contactLatestValue = contactState
+               this.latestValue = contactState
                println("the contact sensor with id:$id is triggered to $value!")
                this.contactState = value
        }
@@ -31,7 +31,7 @@ public class ContactSensor {
 
        def latestValue(String deviceFeature) {
                if (deviceFeature == "contact") {
-                       return contactLatestValue
+                       return latestValue
                }
        }
 }