//Create a class for relative humidity measurement package RelativeHumidityMeasurement import SmartThing.SmartThing public class RelativeHumidityMeasurement extends SmartThing { // id, label, and display name of the device StringBuilder id = new StringBuilder() StringBuilder label = new StringBuilder() StringBuilder displayName = new StringBuilder() // Features with numberical values MutableInteger currentHumidity = new MutableInteger() // Maps from features to values HashMap deviceIntValuesMap = new HashMap() RelativeHumidityMeasurement(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentHumidity) { deviceIntValuesMap = deviceIntValueSmartThing idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName this.currentHumidity = currentHumidity deviceIntValuesMap.put("humidity", currentHumidity) } // Methods to return values def getCurrentHumidity() { return currentHumidity.getValue() } }