//Create a class for contact sensor package ContactSensor import SmartThing.SmartThings public class ContactSensors extends SmartThings { List contacts = new ArrayList() ContactSensors(Closure sendEvent, boolean init) { // Only initialize one time since we only have one device for each capability contacts = smartThings // Initialization StringBuilder id = new StringBuilder("contactID0") StringBuilder label = new StringBuilder("contact") StringBuilder displayName = new StringBuilder("contact0") StringBuilder currentContact = new StringBuilder() if (init) currentContact.append("closed") else currentContact.append("open") contacts.add(new ContactSensor(sendEvent, id, label, displayName, currentContact)) } // Methods to return values def getCurrentContact() { List tmpValues = new ArrayList() tmpValues.add(contacts[0].getCurrentContact()) return tmpValues } }