//Create a class for lock device package Lock import SmartThing.SmartThing public class Lock 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() Lock(Closure sendEvent, String id, String label, String displayName, String currentLock) { deviceValueSmartThing = deviceValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName deviceValuesMap.put("lock", currentLock) } // Methods to set values def lock() { action("locked", "lock") } def lock(LinkedHashMap metaData) { lock() } def unlock() { action("unlocked", "lock") } def unlock(LinkedHashMap metaData) { unlock() } }