Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / SleepSensor / SleepSensors.groovy
index 32895c804919fcd27475f0d3539d24f227415268..fc26621c1f1d586a8d2632987ef05b75c7b849dc 100644 (file)
@@ -34,8 +34,8 @@ public class SleepSensors {
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["value"] != sleepSensors[0].sleeping) {
+                       this.sleeping = eventDataMap["value"]
                        sleepSensors[0].setValue(eventDataMap["value"])
-                       this.sleeping = sleepSensors[0].sleeping
                        sendEvent(eventDataMap)
                }
        }
@@ -53,6 +53,9 @@ public class SleepSensors {
        def find(Closure Input) {
                sleepSensors.find(Input)
        }
+       def sort(Closure Input) {
+               sleepSensors.sort(Input)
+       }
        def collect(Closure Input) {
                sleepSensors.collect(Input)
        }