Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git] / SleepSensor / SleepSensors.groovy
index 269a419e2212b28945b4514ec31cd91e0e0a9f7f..884053cc6dad2ba80430d6d9c06b37194fbc9025 100644 (file)
@@ -25,8 +25,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)
                }
        }
@@ -44,6 +44,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)
        }