//Create a class for beacon sensor package BeaconSensor import SmartThing.SmartThing public class BeaconSensor 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 currentPresence = new StringBuilder() // Maps from features to values HashMap deviceValuesMap = new HashMap() BeaconSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, StringBuilder currentPresence) { deviceValuesMap = deviceValueSmartThing idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName this.currentPresence = currentPresence deviceValuesMap.put("beacon", currentPresence) } // Methods to return values def getCurrentPresence() { return currentPresence.toString() } }