Ich habe dazu ein Item Voice Command angelegt. Dort kommen die gesprochenen Wörter auch als String an. Ich habe zum Test mal folgende Rule geschrieben:
Code: Alles auswählen
rule "Voice"
when
Item VoiceCommand received update
then
val txt = VoiceCommand.state.toString.toLowerCase
logInfo("Test","VoiceCommand hat empfangen "+txt)
if(VoiceCommand.state == "Licht an") {
GF_Office_Light.sendCommand(ON)
}
end
Code: Alles auswählen
rule "Voice"
when
Item VoiceCommand received update
then
val txt = VoiceCommand.state.toString.toLowerCase
logInfo("Test","VoiceCommand hat empfangen "+txt)
switch(receivedEvent) {
case "Licht an" : GF_Office_Light.sendCommand(ON)
case "Licht aus" : GF_Office_Light.sendCommand(OFF)
}
end