Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
[smartthings-infrastructure.git] / StepSensor / StepSensors.groovy
index ea5fd3ddef41962ec5629151d1dce6cd7f86acdd..d3edb7b4f6f9fc035374e54317c3fb5788dbac27 100644 (file)
@@ -15,11 +15,18 @@ public class StepSensors {
        private int steps = 0
 
                
-       StepSensors(Closure sendEvent, int deviceNumbers) {
+       StepSensors(Closure sendEvent, int deviceNumbers, boolean init) {
                this.sendEvent = sendEvent              
                this.deviceNumbers = deviceNumbers
                this.stepSensors = []
 
+               if (init) {
+                       this.goal = 50
+                       this.steps = 0
+               } else {
+                       this.goal = 60
+                       this.steps = 1
+               }
                stepSensors.add(new StepSensor(id, label, displayName, this.steps, this.goal))
        }
 
@@ -65,6 +72,10 @@ public class StepSensors {
                stepSensors[0].currentValue(deviceFeature)//It is called if we have only one device
        }
 
+       def latestValue(String deviceFeature) {
+               stepSensors[0].currentValue(deviceFeature)//It is called if we have only one device
+       }
+
        def getAt(int ix) {
                stepSensors[ix]
        }