//Create a class for motion sensor package MotionSensor import SmartThing.SmartThings public class MotionSensors extends SmartThings { List motionSensors = new ArrayList() MotionSensors(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability motionSensors = smartThings // Initialization StringBuilder id = new StringBuilder("motionSensorID0") StringBuilder label = new StringBuilder("motion") StringBuilder displayName = new StringBuilder("motionSensor0") StringBuilder motion = new StringBuilder() if (init) motion.append("inactive") else motion.append("active") motionSensors.add(new MotionSensor(sendEvent, id, label, displayName, motion)) } // Methods to return values def getCurrentMotion() { List tmpValues = new ArrayList() tmpValues.add(motionSensors[0].getCurrentMotion()) return tmpValues } }