//Create a class for sleep sensor package SleepSensor import SmartThing.SmartThings public class SleepSensors extends SmartThings { List sleepSensors = new ArrayList() SleepSensors(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability sleepSensors = smartThings // Initialization String id = "sleepSensorID0" String label = "sleeping" String displayName = "sleepSensor" String sleeping if (init) sleeping = "sleeping" else sleeping = "not sleeping" sleepSensors.add(new SleepSensor(sendEvent, id, label, displayName, sleeping)) } }