Send voice commands FROM HASS TO Alexa using AVS

At this point, it is possible to send a phrase to Alexa with cURL - https://miguelmota.com/blog/alexa-voice-service-with-curl/ , so I am hopeful that this should be possible.

At the moment, I am working on a script that will use espeak (Text to Voice) to convert a text to a spoken MP3 and then I am planning to send that via cURL to Alexa as a proof of concept.

If that works, then all that needs to be done is to convert it to Python. While I am not familiar with Python, I think if I have a skeleton ready, hopefully someone can work with me to integrate with HASS

Sorry I misunderstood the original question then. You are correct.

So, the works.

My script converted the text “Tell me a joke” into MP3 and sent it to AVS and I got a joke back as a response. So basically this does work as a PoC.

Now I need to convert this to a Python script. will continue to work on this. The problem is identifying the response.

For e.g. if I create a Turn On Light command, I suspect I should be able to use the response code to see if the command was successful or not.

I visualize this as a component that you customize and add a phrase that performs an action.

bump. how did you get on with this, really looking to do this aswell! When I set my self to sleeping, I currently have tasker use google tts to say Alex play thunderstorm sounds. But I would love for it to just automatically happen, through a voice command!

Sorry… got busy and haven’t looked at this yet, but I still want to do it. My python skills are seriously lacking, so will take a while

I would like to see a similar capability perhaps that can be accommodated by sending Alexa a voice command as you have proposed. In my use case, I’d like Alexa to announce events unprompted. Something like “there is a visitor at the front door” if the front door motion detector is triggered, or “the garage door is still open”, etc.

I am aware that Alexa will play “Simon says” by repeating the whatever is said after “Simon says”. Perhap this can be used for unprompted announcements?

Alexa cannot have unprompted announcement. (except the new call / messaging feature which Alexa notify there is a message / call) The only way I know to do what you want is to do what I do, put a speaker right beside your alexa. This solution doesn’t work very well and frankly is redundant. Since I have a speaker right beside alexa, I get HA to use that speaker to say what I would want Alexa to say. I couldn’t get Alexa to act as a bluetooth speaker for HA either.

If we can use “Simon says” as the prompt (sending it silently) and have Alexa say what follows, the effect would seem like an unsolicited prompt to a casual user. I have thought of using the bluetooth remote mic for this purpose, but haven’t hacked into it yet.

I thought what kdvlr was doing was sending “Tellme a joke” to Alexa silently via some sort of mp3 file transfer. Did I misunderstand this?

I don’t think there is way to send mp3 files silently. Here is the remote idea.

1 Like

thats cool.
like that you can have Alexa say a welcome when she detects that you walk in the door.

I know this is old… but I found this:

I followed the instructions for sending HTTP requests and within 5 minutes I was silently sending commands to alexa using the RESTful command component within HA.

My ADT alarm has an Alexa skill, but no Google Assistant integration, and is not accessible by HA. But using the above I’m able to arm and disarm my alarm.

2 Likes

Hi, I found Bespoken being very useful to my project. However, I was unable to install it on my raspberry pi (getting error while using npm install bespoken-tools).

Is it possible to use RESTful platform to send commands to their server without installing bespoken?

How did you accomplish it?

There’s nothing to install if you use the HTTP method. Just follow the instructions here: https://read.bespoken.io/end-to-end/api/#http-api.

But for that why not use tts with polly or google. Must be much simpler and sound more natural

Thank you for this! I’ve been looking for this for a while now. But I am having an issue with my config. I’ve got everything setup with bespoken, but the command I’m trying to send isn’t getting to amazon, and I don’t get any error messages. Would you mind posting an example?

I no longer use this. But you can test in any browser by using a URL like:

https://virtual-device.bespoken.io/process?user_id=[BESPOKEN USERID]&message=Ask ADT to arm the system

You should get a response in JSON format right in the browser.

For example if I want to know the status of my alarm system that is linked to Alexa:

https://virtual-device.bespoken.io/process?user_id=[BESPOKEN USERID]&message=Ask ADT the status of the system

Response (see the “transcript” field item):

`{"streamURL": null, "sessionTimeout": 0, "transcriptAudioURL": null, "message": "ask ADT the status of the system", "transcript": "this system is disarmed", "display": null, "card": null}`

Your HA config would be something like:

rest_command:
  alexa_weather:
    url: https://virtual-device.bespoken.io/process?user_id=[BESPOKEN USERID]&message=Ask ADT to arm the system

Thanks. That makes sense, and is simpler than what I was trying to do. I was trying to use the GET method and use the payload variable of the Rest command. I’ll give this a shot.

you could also use the script that is out there and start alexa routines.

and when you only want alexa to speak you could use the alexa mediaplayer.

1 Like

I already use the Alexa as Media Player for TTS. I was just looking for something to send commands to an Echo to get it to perform alexa routines. I’ll look at the first thread more, but thought that one was just for TTS? Thanks for these!

no with that script you can

  • start routines
  • start weather report
  • start traffic report
  • start music playing
  • get the last alexa
  • etc.

actually everything you can do from inside the alexa app.