Alexa as a speech-to-text engine for rules?

Yes, use the amazonechocontrol binding, it has a channel textToSpeech.
Enclose the text in <speak></speak>. Search the Alexa API docs for more options.

I’m looking for a speech-to-text channel, not a text-to-speech channel.

Sorry I misread that.
You can define item names that Alexa/OH react upon but fully generic STT will not work.

us amazonechocontrol. For every echo-device there’s an “lastVoiceCommand”-channel, which has Alexa’s recognized text - no matter, what you said and Alexa knew the command. You have to create your own rule then to pick/transfer it to your own script.

A-ha! Excellent, thanks for the info! I hadn’t spotted that in the docs, even though I had looked at the binding documentation page. It’s Monday morning and my eyes aren’t working yet.

I notice that it’s a read/write channel so I can use it for both STT for input and TTS for feedback.

Many thanks for your help.

1 Like

Not sure, if that’ll work. I use the “textToSpeech”-channel of each echo-device for audio-feedback like “dish washer is ready” and the like.

OK, thanks for the info, I’ll do some tinkering/testing and find out.

I‘m doing this for some weeks now to control my „dumb“ TV via an IR blaster. Works perfectly well. See here (the custom skill part is essential, though).

use amazonechocontrol. For every echo-device there’s an “lastVoiceCommand”-channel, which has Alexa’s recognized text - no matter, what you said and Alexa knew the command. You have to create your own rule then to pick/transfer it to your own script.

While that will pass on your speech-to-text to your script, I’m wondering if Alexa will also respond to it on its own, i.e., telling you that it doesn’t understand your request? Or is this silenced somehow? Thanks.

Alexa isn’t affected at all from this. Meaning you could say: “Alexa, wrzghber” - and the lastCommand will change to “Alexa, wrzghber” - and Alexa will tell you “Sorry, I didn’t understand”.

If you say “Alexa, what’s the weather like today” - same thing except Alexa will then tell you the forecast.

1 Like

I tried to achieve this in the past but couldn’t find a way to make it work.
Using the Alexa routines you are able to introduce custom phrases that do not provide a response but as far I saw it can not content dynamic parts.

In case you find it useful, to introduce text in openHAB I was relying on the pulse audio source and a raspberry pi with a speaker, and now I’m mostly using my phone with this add-on I’m writing: HAB Speaker (dialog processing in the browser)
For the matter of send commands to different items I created this one: ActionTemplateInterpreter Next
Hope you find some of them interesting, sorry I couldn’t help you with the actual question.
Regards!

1 Like

When defining this in a custom skill (see link above) you can a) state in the custom skill what the response should be (as @binderth said it’s only all about the lastCommand) or b) make Alexa say what you like in a rule that picks up and interprets the lastCommand.

1 Like

If it’s a phrase that Alexa hasn’t already associated with some other device, that’s true. For a specific example, I have an OpenHAB rule where I can tell Alexa, “Turn on Netflix”, and the rule will execute successfully. But at the same time, Alexa goes on to verbally state an error message that my DirecTV, which it assumes I was addressing, cannot complete the request. For some reason it associates the word “Netflix” with that device. I’d like to find a way to keep Alexa from giving me that error message.

Have you referred to point 4.1 in my step-by-step mentioned above?

If you still have problems let me know, then I can try to add some more details to this step (which, after reading it again, is not as detailed as the others).

Thanks, I did see that but wasn’t sure. I tried finding how to create a custom skill in Alexa but it looked like I had to start an Alexa developer account and it looked pretty involved so I figured I took a wrong turn.

Ah! I see now. It’s a routine, not a custom skill. I’ll try that, thanks.

Nope, no developer account is needed.

I just updated 4.1 with some more details on how to get there (somehow hidden / I always struggle to find it), incl. a screenshot. If you need more help, let me know.

In that area, the Alexa App is really messy. For me it’s called “Custom Skill”, except that I cannot access it via the “Skills & Games”-section (even though my custom skill shows up there), but I have to go via “Blueprints”.

I see, that would explain the confusion. Thanks for replying back!

Yes you may use Alexa as a TTS engine but there will be limitations regarding the variety of voices available and the way you might want to save the audio files generated…
It’s far better to integrate a separate text to speech AI with your browser or apps and customize the voice outputs, save the audio files if necessary and use it on different projects as per your requirements