Fixing some bugs
[smartthings-infrastructure.git] / MotionSensor / MotionSensors.groovy
index 52034d9521b50b2823b4d40be65c9566cb06ea86..c799b0e77766697fd893a67c8bebcdfe314452e5 100644 (file)
@@ -2,9 +2,6 @@
 package MotionSensor
 import Timer.SimulatedTimer
 
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
-
 public class MotionSensors {
        private int deviceNumbers
        private List motionSensors
@@ -19,19 +16,20 @@ public class MotionSensors {
        private String motionLatestValue = "inactive"
 
                
-       MotionSensors(Closure sendEvent, int deviceNumbers) {
+       MotionSensors(Closure sendEvent, int deviceNumbers, boolean init) {
                this.sendEvent = sendEvent              
                this.deviceNumbers = deviceNumbers
                this.motionSensors = []
 
-               /*def init = Verify.getBoolean()
                if (init) {
                        this.motion = "inactive"
+                       this.currentMotion = "inactive"
                        this.motionLatestValue = "inactive"
                } else {
                        this.motion = "active"
+                       this.currentMotion = "active"
                        this.motionLatestValue = "active"
-               }*/
+               }
                motionSensors.add(new MotionSensor(id, label, displayName, this.motion, this.motionLatestValue))
        }
 
@@ -65,7 +63,10 @@ public class MotionSensors {
        def collect(Closure Input) {
                motionSensors.collect(Input)
        }
-
+       
+       def currentState(String deviceFeature) {
+               currentValue(deviceFeature)
+       }
 
        def currentValue(String deviceFeature) {
                motionSensors[0].currentValue(deviceFeature)//It is called if we have only one device
@@ -76,7 +77,7 @@ public class MotionSensors {
        }
 
        def statesSince(String info, Date dateObj) {
-               return motionSensors[0].statesSince(info, dateObj)
+               return motionSensors[0].statesSince()
        }
 
        def getAt(int ix) {