1 //Create a class for motion sensor
3 import SmartThing.SmartThings
5 public class MotionSensors extends SmartThings {
6 List motionSensors = new ArrayList()
8 MotionSensors(Closure sendEvent, boolean init) {
9 // Only initialize one time since we only have one device for each capability
10 motionSensors = smartThings
13 StringBuilder id = new StringBuilder("motionSensorID0")
14 StringBuilder label = new StringBuilder("motion")
15 StringBuilder displayName = new StringBuilder("motionSensor0")
16 StringBuilder motion = new StringBuilder()
19 motion.append("inactive")
21 motion.append("active")
23 motionSensors.add(new MotionSensor(sendEvent, id, label, displayName, motion))
26 // Methods to return values
27 def getCurrentMotion() {
28 List tmpValues = new ArrayList()
29 tmpValues.add(motionSensors[0].getCurrentMotion())