Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / MotionSensor / MotionSensors.groovy
index 764aa3e9c505d0c405933f12b2b7489eb2d38abe..52034d9521b50b2823b4d40be65c9566cb06ea86 100644 (file)
@@ -38,10 +38,10 @@ public class MotionSensors {
        //By Model Checker
        def setValue(LinkedHashMap eventDataMap) {
                if (eventDataMap["value"] != motionSensors[0].motion) {
+                       this.motionLatestValue = eventDataMap["value"]
+                       this.motion = eventDataMap["value"]
+                       this.currentMotion = eventDataMap["value"]
                        motionSensors[0].setValue(eventDataMap["value"])
-                       this.motionLatestValue = motionSensors[0].motionLatestValue
-                       this.motion = motionSensors[0].motion
-                       this.currentMotion = motionSensors[0].motion
                        sendEvent(eventDataMap)
                }
        }
@@ -59,6 +59,9 @@ public class MotionSensors {
        def find(Closure Input) {
                motionSensors.find(Input)
        }
+       def sort(Closure Input) {
+               motionSensors.sort(Input)
+       }
        def collect(Closure Input) {
                motionSensors.collect(Input)
        }