Is it possible to use Alexa as a speech to text engine? By this I mean not use any item attributes to define an item as a thermostat, etc. Instead, I’d like to capture what I say to Alexa and pass it on to my own script.
I’ve looked at the documentation but can’t see how I can achieve this.
Yes, use the amazonechocontrol binding, it has a channel textToSpeech.
Enclose the text in <speak> … </speak>. Search the Alexa API docs for more options.
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.
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.
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!
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.
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.
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”.