Fixing bug in Mobile Presence class
[smartthings-infrastructure.git] / SpeechSynthesis / SpeechSynthesises.groovy
1 //Create a class for speech synthesis
2 package SpeechSynthesis
3 import SmartThing.SmartThings
4
5 public class SpeechSynthesises extends SmartThings {
6         List speechSynthesises = new ArrayList()
7                 
8         SpeechSynthesises(Closure sendEvent, boolean init) {
9                 // Only initialize one time since we only have one device for each capability
10                 speechSynthesises = smartThings
11
12                 // Initialization
13                 String id = "speechSynthesisID0"
14                 String label = "level"
15                 String displayName = "speechSynthesiser"
16                 Integer level
17
18                 if (init)
19                         level = 50
20                 else
21                         level = 60
22
23                 speechSynthesises.add(new SpeechSynthesis(sendEvent, id, label, displayName, level))
24         }
25
26         // Methods to set values
27         def setLevel(int level) {
28                 speechSynthesises[0].setLevel(level)
29         }
30
31         def speak(String message) {
32                 speechSynthesises[0].speak(message)
33         }
34 }