Fixing bug in Mobile Presence class
[smartthings-infrastructure.git] / StepSensor / StepSensors.groovy
1 //Create a class for step sensor
2 package StepSensor
3 import SmartThing.SmartThings
4
5 public class StepSensors extends SmartThings {
6         List stepSensors = new ArrayList()
7                 
8         StepSensors(Closure sendEvent, boolean init) {
9                 // Only initialize one time since we only have one device for each capability
10                 stepSensors = smartThings
11
12                 // Initialization
13                 String id = "stepSensorID0"
14                 String label = "steps"
15                 String displayName = "stepSensor"
16                 Integer steps
17                 Integer goal
18
19                 if (init) {
20                         goal = 50
21                         steps = 35
22                 } else {
23                         goal = 40
24                         steps = 60
25                 }
26
27                 stepSensors.add(new StepSensor(sendEvent, id, label, displayName, steps, goal))
28         }
29 }