Changes in classes: new concept for latest value + all types of events generated...
[smartthings-infrastructure.git] / MotionSensor / MotionSensors.groovy
index 85167131551b73f787be48e6525bb806a5e2db8c..340e124e19d4484b124109b78d09defc7551d351 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)
        }