//Create a class for smoke detector package SmokeDetector import SmartThing.SmartThing public class SmokeDetector extends SmartThing { // id, label, and display name of the device StringBuilder id = new StringBuilder() StringBuilder label = new StringBuilder() StringBuilder displayName = new StringBuilder() // Features with string values StringBuilder currentSmoke = new StringBuilder() // Maps from features to values HashMap deviceValuesMap = new HashMap() SmokeDetector(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentSmoke) { deviceValuesMap = deviceValueSmartThing idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName this.currentSmoke = currentSmoke deviceValuesMap.put("smoke", currentSmoke) } // Methods to return values def getCurrentSmoke() { return currentSmoke.toString() } }