Openhab2 voice command

How to configure or add voice command and ill be using andriod phone to speak over ???! I already tried to add string to my items and write my rules but nothing happens when i speak

Here’s an OH1 guide, but I believe you would follow the same principles in OH2

I have done this already and nothing happens when i speak over !
Im using rpi3 with the latest debain and OH2 and for my andriod phone im
using habpanel with google voice command

I’m tinkering with this at the moment myself. I use habdroid on my phone (can’t see habpanel in the android app store).

For me once the Google voice thing (which is SLOW) finishes the habdroid app shows the recognised phrase, and from there it’s just following your voice command rule to see if it should be matching based on keywords in that phrase.

Or is habpanel just a web UI option for Chrome on android? If so that may be where it’s failing - at the point of getting the Google voice recognosed phrase into openhab

I think i said that wrong, im using a phone website where i have saved it
to my homescreen and im trying to use voice command from habpanel !
My bad about the wrong info …

Well perhaps as a test try it in the habdroid app. If it works from that then the browser based habpanel is at fault(my guess)

Yes, just a web ui, no separate app.

Thats what i have in my items :

Switch ColorLED{ gpio=“pin:12” }
Switch RoomLIGHT{ gpio=“pin:16” }
Switch LED{ gpio=“pin:20” }
Switch TestB{ gpio=“pin:21” }
Switch TestD{ gpio=“pin:26” }
Switch TestE{ gpio=“pin:19” }

String VoiceCommand

And thats what i have in my rules :

import org.openhab.model.script.actions.*
import org.openhab.core.library.types.*
import java.util.*
rule „test example rule name“
when
Item VoiceCommand received command
then
var String command = VoiceCommand.state.toString.toLowerCase
logInfo(„Voice.Rec“,“VoiceCommand received „+command)
if (command.contains(„turn on Led“) {
LED.sendCommand(ON)
}
else if (command.contains(„turn off led“) {
LED.sendCommand(OFF)
}
end

I got this from searching online and i have my website for OH2 downloaded to my home from phone browser so i can use habpanel

Hi there,
I know this is likely to be a bit late for you considering the date but I will post here anyway as this thread is placed highly on Google
I was having the same issue as you and I think I was even following the same example as you.

The way I got my set up to work was to add an additional ) in the rule.
Here is my full rule:

rule “Light Control”
when
Item VoiceCommand received command
then
var String command = VoiceCommand.state.toString.toLowerCase
logInfo(“Voice.Rec”,"VoiceCommand received "+command)

if (command.contains(“lights on”)) {
sendCommand(Light, ON)
}

else if (command.contains(“lights off”)) {
sendCommand(Light, OFF)
}

end

1 Like

Hi, Where did you get those immages from? how do you do them?

Thanks

This is Habpenal and this pictures i posted is just from the openhab2 server… From habpenal custimize and edit

Thank you Matt. I will try this and let you know if it works

I know it’s “a bit” later but as @lmarinen_946Matt said, this is the first post in google search and these are my 2 cents.

It’s necessary to enable / use Google Voice, else you wouldn’t see the mic icon in OpenHab Android App, therefore you wouldn’t be able to speak any command.

Bye!

I still couldn’t get it to work despite reading all of this. I am using the openHAB Android app and I can see the microphone icon in the top right corner. I can speak a command and can see that it was understood correctly.

In the config, I have

String VoiceCommand

and

rule "Voice Control"
when
    Item VoiceCommand received update
then
    val txt = VoiceCommand.state.toString.toLowerCase
    logInfo("Test","VoiceCommand received "+txt)
    say(txt)
end

but this rule never triggers. I can trigger it my using Karaf to send an update to the item like

smarthome:update VoiceCommand test

1 Like

Just a guess, but try changing received update to received command

Please make sure Default Human Language Interpreter is set to Rule-based Interpreter: http://openhab:8080/paperui/index.html#/configuration/system and select the correct item here: http://openhab:8080/paperui/index.html#/configuration/services?tab=voice Rule Voice Interpreter => Configure => Select correct item.

3 Likes

Nice, that worked!

Hello guys, do you know is there any way to change Google Voice command language?

I believe this can be done from your settings in google settings and language preferences, or Google assisstants settings language preferences!

1 Like