Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / PresenceSensor / PresenceSensors.groovy
index 05721d5b1ec58da4a5d29fcda8e556d27def909f..ec24f3b0c675ebf8433a0a42b279701a5ae9c2ae 100644 (file)
@@ -38,10 +38,10 @@ public class PresenceSensors {
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["value"] != presenceSensors[0].presence) {
+                       this.presenceLatestValue = eventDataMap["value"]
+                       this.presence = eventDataMap["value"]
+                       this.currentPresence = eventDataMap["value"]
                        presenceSensors[0].setValue(eventDataMap["value"])
-                       this.presenceLatestValue = presenceSensors[0].presenceLatestValue
-                       this.presence = presenceSensors[0].presence
-                       this.currentPresence = presenceSensors[0].presence
                        sendEvent(eventDataMap)
                }
        }
@@ -59,6 +59,9 @@ public class PresenceSensors {
        def find(Closure Input) {
                presenceSensors.find(Input)
        }
+       def sort(Closure Input) {
+               presenceSensors.sort(Input)
+       }
        def collect(Closure Input) {
                presenceSensors.collect(Input)
        }