Hi,
don’t know if this is the right forum - maybe this is only for the built in TTS in OH??
I’m using Rhasspy for voice recognition, and I managed to get it working with openhab through MQTT. This works fine so far, but now I’m trying to setup some rules…
So my biggest problem is to find any information about how to send answers to the requests e.g. “what time is it” or similar… I know I’m not the only one using Rhasspy with OH so maybe one could give me a little more information how this answer code would look like in a DSL rule.
A good information would be, which mqtt-topic to use to get Rhasspy speaking to me
maybe some examples how to configure mqtt…
this is my configuration so far:
rhasspy.things
Bridge mqtt:broker:Rhasspy "MQTT - Rhasspy Broker" @ "MQTT" [
host="192.168.xxx.xxx",
secure=false,
port=1883,
qos=2,
retainMessages=false,
clientID="Openhab3",
keep_alive_time=60000,
reconnect_time=30000,
username="anyname",
password="anypasswd"
]
{
// Rhasspy Intent
Thing topic Rhasspy_Intent "MQTT - Rhasspy Intents" @ "MQTT" {
Channels:
Type string : Rhasspy_Time "Rhasspy Time Intent" [
stateTopic="hermes/intent/GetTime"
]
Type string : Rhasspy_Date "Rhasspy Date Intent" [
stateTopic="hermes/intent/GetDate"
]
Type string : Rhasspy_Day "Rhasspy Day Intent" [
stateTopic="hermes/intent/GetDay"
]
Type string : Rhasspy_Alarm "Rhasspy Alarm Intent" [
stateTopic="hermes/intent/SetAlarm"
]
Type string : Rhasspy_Timer "Rhasspy Timer Intent" [
stateTopic="hermes/intent/SetTimer"
]
Type string : Rhasspy_Temperature "Rhasspy Temperature Intent" [
stateTopic="hermes/intent/GetTemperature"
]
Type string : Rhasspy_Humidity "Rhasspy Humidity Intent" [
stateTopic="hermes/intent/GetHumidity"
]
Type string : Rhasspy_Light "Rhasspy Light Intent" [
stateTopic="hermes/intent/ChangeLightState"
]
Type string : Rhasspy_LightScene "Rhasspy Light Scene Intent" [
stateTopic="hermes/intent/ChangeLightScene"
]
Type string : Rhasspy_Volume "Rhasspy Volume Intent" [
stateTopic="hermes/intent/SetVolume"
]
}
}
rhasspy.items
String Rhasspy_Time "Rhasspy Time Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Time" }
String Rhasspy_Date "Rhasspy Date Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Date" }
String Rhasspy_Day "Rhasspy Day Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Day" }
String Rhasspy_Alarm "Rhasspy Alarm Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Alarm" }
String Rhasspy_Timer "Rhasspy Timer Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Timer" }
String Rhasspy_Temperature "Rhasspy Temperature Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Temperature" }
String Rhasspy_Humidity "Rhasspy Humidity Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Humidity" }
String Rhasspy_Light "Rhasspy Light Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Light" }
String Rhasspy_LightScene "Rhasspy Light Scene Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_LightScene" }
String Rhasspy_Volume "Rhasspy Volume Intent" (gRhasspy) { channel="mqtt:topic:Rhasspy:Rhasspy_Intent:Rhasspy_Volume" }
here is an example rule for light control
rule "Rhasspy Light Control"
when
Item Rhasspy_Light received update
then
var String intentItemSlot = transform("JSONPATH", "$.slots[?(@.slotName=='name')].value.value", Rhasspy_Light.state.toString)
var String intentStatusSlot = transform("JSONPATH", "$.slots[?(@.slotName=='state')].value.value", Rhasspy_Light.state.toString)
if ( intentItemSlot == "Wohnzimmer" ) {
logDebug ("Rhasspy", "Light Voice Command Received")
if ( intentStatusSlot == "ein" ) {
LightLivingroomColor.sendCommand("100")
}
if ( intentStatusSlot == "aus" ) {
LightLivingroomColor.sendCommand("0")
}
}
if ( intentItemSlot == "Standleuchten" ) {
logDebug ("Rhasspy", "Light Voice Command Received")
if ( intentStatusSlot == "ein" ) {
gStandsBulbsSwitch.sendCommand("ON")
}
if ( intentStatusSlot == "aus" ) {
gStandsBulbsSwitch.sendCommand("OFF")
}
}
if ( intentItemSlot == "TV-Wand" ) {
logDebug ("Rhasspy", "Light Voice Command Received")
if ( intentStatusSlot == "ein" ) {
LightTvPower.sendCommand("ON")
}
if ( intentStatusSlot == "aus" ) {
LightTvPower.sendCommand("OFF")
}
}
logDebug ("rhasspy.rules testing", "Rhasspy raw JSON: " + Rhasspy_Light.state.toString)
logDebug ("rhasspy.rules testing", "Rhasspy intentItemSlot: " + intentItemSlot)
logDebug ("rhasspy.rules testing", "Rhasspy intentStatusSlot: " + intentStatusSlot)
end
Thanx in advance
Dan