Adding threeAxis event to the python script!
[smartthings-infrastructure.git] / StepSensor / StepSensors.groovy
index ea5fd3ddef41962ec5629151d1dce6cd7f86acdd..d9200c6a24e258144af1c4ca66576836e6a407d6 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 = 35
+               } else {
+                       this.goal = 40
+                       this.steps = 60
+               }
                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]
        }