The /api/listen-for-command endpoint is probably the best way to achieve this. If you POST to this endpoint, Rhasspy will begin listening for a command (no beep), and automatically handle the command given (you’ll also get back the JSON).
I’ve just added a few options to listen-for-command to help you out:
/api/listen-for-command?timeout=5 will time out after 5 seconds
/api/listen-for-command?entity=my-entity&value=my-value will set the slot my-entity to my-value in the recognized intent
You can use the second option to pass some event id into HA. It will come in as a property of the HA event from Rhasspy.
The only thing missing here is the ability to select which intents Rhasspy will listen for. The infrastructure to do this in present, but I haven’t decided yet on how to optimally expose it. So, for now, Rhasspy will always listen for all possible intents.
Thank you Michael for the fast implementation. This will be enough for my first trys to set something up.
Will try it when there is an updated docker image.
Great to hear the specific intent idea might be possible in the future
Thanks for the pointers.
I am using Node-Red for automations.
I was thinking I would use a web-socket connection to send the TTS message, but I think that Rhasspy is not setup to allow messages, only to broadcast (I know next to nothing about web-sockets).
Anyway, I found the POST in the http request node - and it worked on the first try!
… and a few minutes later I have my first Rhasspy response working!
Web-socket listener node - Listener for Rhasspy intents
Switch node - filters for only the designated intent
HA Current State node - get the sensor value (in this case outside temperature)
Template node - write the text payload “Current Temperature outside is {{payload}}”
HTTP Request node - send payload back to Rhasspy TTS.
X86_64 Debian Server with rhasspy-server (2.3) and mosquitto mqtt server (without TLS) as docker containers.
Pi Zero W (Raspbian Buster Lite. up to date) + ReSpeaker Head as Satellite using hermes-audio-server (0.2.0).
Were did you had your problems? I only had issues with the default alsa config made by the respeaker drivers. For some reason hermes-audio-server was not happy with it and i hat to modify it a bit otherwise hermes would crash with incoming audio.
Hi can you help me on how to use this in nodered?
I got it working with curl -post but the same url wont work in nodered, rhasspy listens but the custom settings wont.
I was talking about using this custom settings. Rhasspy activates but timeout or the entitity option wont work if i send this using a simple http post note.
Using curl from the shell works fine tho so it is a problem with how i setup the node, i justed pasted the whole url with the optionts (?timeout=5&entity…) but this wont work.
Just pushed an update that should address this. Rhasspy was returning the right stuff in the POST response, but any intents coming out of the websocket weren’t properly updated. The timeout also wasn’t being honored in some circumstances.
Have you tried starting both services with the -v option for verbose output? And the value for the microphone volume is set high enough in the ALSA settings?
pcm.!default {
type asym
playback.pcm "playback"
capture.pcm "capture"
}
pcm.playback {
type plug
slave.pcm "hw:1,0"
}
pcm.capture {
type plug
slave.pcm "hw:1,0"
}
So i removed all the dmix stuff, since hermes is only thing running on this right now it should not be a problem, but if you want more services to use the audio devices this might not work for you.
Thanks, it is working now, but it seems the timeout is still limited to 2-3 seconds. But this is not an issue with my current usecase.
btw if someone is intrested i can post some examples of what im doing.
I have setup my system to sound like an english butler and created a funny command for my girlfriend.
You can tell rhasspy that you would like to take a bath soon, then it checks the temperature in the bathroom and if its below a certain threshold it will ask you if it should turn on the radiator first. if you anser with yes it will check if the window is open and turn on the radiator, if the window is open it will report that back and wont turn on the radiator.
im using a simple yes or no intent for the answer to rhasspys question but since i set a special entity for this it can see that this is the response for the questions it just asked.
So I am a snips refugee and Rhasspy looks like the most promising tool to replace it (this new Almond development is interesting but lacks documentation).
This thread is quite large… as a newbie to Rhasspy what’s the recommended set of servicoto use? I definitely need something flexible that hab handle words not explicitly in the sentences. Training time and CPU isn’t an issue, but privacy is, I’d rather nothing go to the cloud. Hosting extra services is fine.
Also is there any sort of shared repo of Rhasspy sentences/intents? Seeing real world examples is super helpful I find.
Edit: reading back over the last few weeks of posts, I see that Rhasspy despite being modular in so many ways, hadn’t quite reached modularity when it comes to what other services call apps or skills.
Assume I want some intents executed against HA and some to just execute a python script (to fetch the weather for example), is that possible now with Rhasspy?