//Create a class for alarm device package Alarm import SmartThing.SmartThing public class Alarm 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() Alarm(Closure sendEvent, String id, String label, String displayName, String currentAlarm) { deviceValueSmartThing = deviceValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName deviceValuesMap.put("alarm", currentAlarm) } // Methods to set values def both() { action("both", "alarm") } def on() { action("both", "alarm") } def off() { action("off", "alarm") } def siren() { action("siren", "alarm") } def strobe() { action("strobe", "alarm") } }