1 // Create a class for presence sensor
3 import SmartThing.SmartThing
5 public class PresenceSensor extends SmartThing {
6 // id, label, and display name of the device
10 // Maps from features to values
11 HashMap<String, String> deviceValuesMap = new HashMap<String, String>()
12 // Possible values for eventsSince method
13 List<String> possibleValues = new ArrayList<String>();
15 PresenceSensor(Closure sendEvent, String id, String label, String displayName, String currentPresence) {
16 deviceValuesMap = deviceValueSmartThing
18 labelSmartThing = label
19 displayNameSmartThing = displayName
20 sendEventSmartThings = sendEvent
21 possibleValuesSmartThings = possibleValues
26 this.displayName = displayName
27 possibleValues.add("present")
28 possibleValues.add("not present")
30 deviceValuesMap.put("presence", currentPresence)