//Create a class for contact sensor package ContactSensor import SmartThing.SmartThing public class ContactSensor extends SmartThing { // id, label, and display name of the device String id String label String displayName // Maps from features to values HashMap deviceValuesMap = new HashMap() // Possible values for eventsSince method List possibleValues = new ArrayList(); ContactSensor(Closure sendEvent, String id, String label, String displayName, String currentContact) { deviceValueSmartThing = deviceValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent possibleValuesSmartThings = possibleValues // Initialization this.id = id this.label = label this.displayName = displayName possibleValues.add("closed") possibleValues.add("open") deviceValuesMap.put("contact", currentContact) } }