1 //Create a class for alarm device
3 import SmartThing.SmartThing
5 public class Alarm 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>()
13 Alarm(Closure sendEvent, String id, String label, String displayName, String currentAlarm) {
14 deviceValueSmartThing = deviceValuesMap
16 labelSmartThing = label
17 displayNameSmartThing = displayName
18 sendEventSmartThings = sendEvent
23 this.displayName = displayName
25 deviceValuesMap.put("alarm", currentAlarm)
28 // Methods to set values
30 action("both", "alarm")
34 action("both", "alarm")
38 action("off", "alarm")
42 action("siren", "alarm")
46 action("strobe", "alarm")