I’m using HABdroid ver 1.8.0.5 and here is my configuration (very simple)
.item:
String VoiceCommand
.rule:
rule "VoiceControl"
when
Item VoiceCommand received command
then
val txt = VoiceCommand.state.toString.toLowerCase
logInfo("Voice.Rec","VoiceCommand received "+txt)
if(txt.contains("on")){
Light_C_Staircase.sendCommand(ON)
}else if (command.contains("off")) {
Light_C_Staircase.sendCommand(OFF)
}
end
On HABDroid I click on micro symbol and start speaking, the system then pop up a little box which informs me the words I’ve just said. However the switch Light_C_Staircase doesn’t change at all. Please help me to fix this. It would be a great help!
rule "VoiceControl"
when
Item VoiceCommand received command
then
val txt = receivedCommand.toString.toLowerCase
logInfo("Voice.Rec","VoiceCommand received "+txt)
if (txt.contains("on") {
Light_C_Staircase.sendCommand(ON)
else if(txt.contains("off"))
Light_C_Staircase.sendCommand(OFF)
}
end
yes it works thanks sihui, but there are still some problems:
it looks like HABdroid use googleTTS service but mainly in my native language. Thus, in my rules file I create an if command to compare VoiceCommand value with the words from my language. For example:
if (txt.contains("khách")) {
Light_C_Staircase.sendCommand(ON)
}
Then I said to Habdroid the word “khách” and the result of VoiceCommand item was perfectly show up.(I did this for debugging purpose:
Item:
String VoiceCommand "[%s]"
sitemap:
Text item=VoiceCommand
this makes things easier to observe because I only grab my android phone to play around with HABdroid, too lazy to use tail command on terminal screen )
However, my Light_C_Staircase switch doesn’t change to ON
If you couldn’t solve the problem then I am very pleased to use HABDroid Voice controlling system which mainly based on English. Can you show me how to change it to use English as its native language?
2)Furthermore, some words which contains special character from my language can not typed in. I mean it does appear correctly when I am typing but after I save the rule file and open it again, several characters are change to “?”. I think it’s a error in font family, then I’ve tried many solutions from google but still no progress
Hi I’m testing the voice command, but in the rule the software designer warns me of the error in parentheses {}
see attached video images Error Rules|666x500?
can you help me!
thank you
when
Item VoiceCommand received command
then
val txt = receivedCommand.toString.toLowerCase
logInfo(“Voice.Rec”,"VoiceCommand received "+txt)
if (txt.contains(“on”))
Test_VOICE.sendCommand(ON)
else if(txt.contains(“off”))
Test_VOICE.sendCommand(OFF)
end