// Create a class for presence sensor package PresenceSensor import SmartThing.SmartThing public class PresenceSensor 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(); PresenceSensor(Closure sendEvent, String id, String label, String displayName, String currentPresence) { deviceValuesMap = deviceValueSmartThing idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent possibleValuesSmartThings = possibleValues // Initialization this.id = id this.label = label this.displayName = displayName possibleValues.add("present") possibleValues.add("not present") deviceValuesMap.put("presence", currentPresence) } }