//Create a class for speech synthesis package SpeechSynthesis import SmartThing.SmartThing public class SpeechSynthesis extends SmartThing { // id, label, and display name of the device String id String label String displayName // Maps from features to values HashMap deviceIntValuesMap = new HashMap() SpeechSynthesis(Closure sendEvent, String id, String label, String displayName, Integer currentLevel) { deviceIntValueSmartThing = deviceIntValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName deviceIntValuesMap.put("level", currentLevel) } // Methods to set values def setLevel(int newValue) { action(newValue, "level") } def speak(String message) { println("Speech synthesis with id:$id, SPEAKING:\"$message\"!") } }