Fixing a bug: unlock is supposed to be recognized as lock event.
[smartthings-infrastructure.git] / PresenceSensor / PresenceSensor.groovy
index 5f15a6f60febaf7ba031d4eca8721707ad7ebf3b..b3707361e2aa3fb86d334935fd93a7a4d05fd3c4 100644 (file)
@@ -20,12 +20,15 @@ public class PresenceSensor {
        }
 
        def setValue(String value) {
-               this.presenceLatestValue = presence
                println("the presence sensor with id:$id is triggered to $value!")
+               this.presenceLatestValue = value
                this.presence = value
                this.currentPresence = value
        }
 
+       def currentState(String deviceFeature) {
+               return [rawDateCreated: [time: System.currentTimeMillis()]]
+       }
        
        def currentValue(String deviceFeature) {
                if (deviceFeature == "presence") {