wkellen
Posts: 7
Joined: Thu Dec 27, 2012 2:56 pm

Make Alexa speak

Thu Sep 12, 2019 7:30 pm

I have searched everywhere and can only find the reverse of what I want. It always shows controlling the rpi with an Alexa, but not Alexa with a rpi.

Basically what I want is to send a command to all of my Alexa's to speak a phrase when an input to the rpi gpio happens.

For instance, when GPIO 10 goes to HIGH, broadcast to all alexas "Attention! The trigger has been tripped!"

Can someone point me in the right direction?

Thanks!

Andyroo

Re: Make Alexa speak

Thu Sep 12, 2019 7:35 pm

This may help https://developer.amazon.com/docs/alexa ... rview.html

No idea if the Pi has a toolkit / code examples for this though.

flipontheradio
Posts: 11
Joined: Tue Jul 23, 2019 3:37 pm

Re: Make Alexa speak

Thu Sep 12, 2019 8:29 pm

You might be able to accomplish this if you have a home automation hub like Smartthings. I know you can have sensors setup that will trigger routines with Alexa where you can have her say just about anything. All my doors trigger multiple echo's in my house when they are opened, i.e. Alexa will say "Garage door is open", "Front door is open", etc. If you can create a virtual switch that gets triggered and it reports to your hub you could potentially create a routine so Alexa will say whatever you want.

https://www.amazon.com/gp/help/customer ... G202200080

User avatar
neilgl
Posts: 2183
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Make Alexa speak

Thu Sep 12, 2019 8:35 pm

An easy way is to install openhab2 on your pi, then the Alexa binding.
You can then get Alexa to say anything you want using Alexa_TTS.
Add a rule in openhab2 that looks at GPIO, then get Alexa to speak. That's what I do.

wkellen
Posts: 7
Joined: Thu Dec 27, 2012 2:56 pm

Re: Make Alexa speak

Sat Sep 14, 2019 12:25 am

All of the responses were great ways to achieve what I want. I really was looking for a dumbed down way. I found this to be very helpful.
https://community.home-assistant.io/t/a ... /52067/243

With it I was able to actually create 2 bash script files that made it speak from typing in a terminal. Now I can have the triggered GPIO execute the script without all the extra software.

flipontheradio
Posts: 11
Joined: Tue Jul 23, 2019 3:37 pm

Re: Make Alexa speak

Sat Sep 14, 2019 12:59 am

Thanks for posting that you found a solution! I might try to integrate this with Blue Iris to get a verbal notification if motion is detected on a camera.

User avatar
neilgl
Posts: 2183
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Make Alexa speak

Sun Sep 15, 2019 10:28 am

Hang on a second, that link is using Home Assistant / hassio (all that extra software?)

flipontheradio
Posts: 11
Joined: Tue Jul 23, 2019 3:37 pm

Re: Make Alexa speak

Mon Sep 16, 2019 5:14 am

The link gives details on writing a shell script to execute a curl request to Amazon's api to make an Alexa device speak which is the solution the OP was referring to. It also gives details on executing the script within home assistant which is why it's on that forum.

wkellen
Posts: 7
Joined: Thu Dec 27, 2012 2:56 pm

Re: Make Alexa speak

Wed Sep 18, 2019 10:55 pm

No problem. I hate when a topic just stops and nobody knows what the solution was.

Yes, and yes.

I will note that there is a volume level in one of the files that was set to 30. I could barely hear it. I changed that to 100 and it was loud and clear.

I ended up with 2 script files and no home automation software was installed.

User avatar
neilgl
Posts: 2183
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Make Alexa speak

Thu Sep 19, 2019 12:39 pm

OK but what two scripts are they?

wkellen
Posts: 7
Joined: Thu Dec 27, 2012 2:56 pm

Re: Make Alexa speak

Tue Sep 24, 2019 3:00 am

The first file was called alexa_remote_control.sh. I downloaded it and edited for my username/pass...

Then I created a file called test.sh

Inside this file is

Code: Select all

./alexa_remote_control.sh -d "My Echo Dot" -e speak:" This is a test!"

Give both files executable permissions.
Then run from terminal with...

./test.sh

ScottMayo
Posts: 9
Joined: Mon Sep 25, 2017 1:34 pm

Re: Make Alexa speak

Thu Jun 25, 2020 9:50 pm

I'm so lost.

I have a copy of alexa_remote_control.sh, but I have no idea how to get it to log in, largely because I don't know what it wants for SET_MAIL, SET_PASSWORD and SET_MFA_SECRET. I've made a few attempts to set things up in Amazon websites but honestly I don't know if I was even visiting the right pages. I'm not at all familiar with AWS. Can someone walk me through "go here and type this"?

shankskill
Posts: 1
Joined: Tue Jul 07, 2020 11:55 pm

Re: Make Alexa speak

Wed Jul 08, 2020 12:22 am

This is a step by step for how I got it to work:
  • Edit the file by using

    Code: Select all

     nano alexa_remote_control.sh 
    I am in the United States, so I personally modified

    Code: Select all

     SET_LANGUAGE= 'amazon.de'--> SET_LANGUAGE = 'amazon.com'
     SET_AMAZON = 'amazon.de' --> SET_AMAZON = 'amazon.com'
     SET_ALEXA = 'alexa.amazon.de' --> SET_ALEXA = 'pitangui.amazon.com'
      
    I also had trouble logging in, so I commented out

    Code: Select all

     #SET_MFA_SECRET= ' ' 
    If you are also having trouble logging in, you've probably experienced a captcha screen. A way to get around this is to download a cookies extension: https://chrome.google.com/webstore/deta ... jfg?hl=en and manually login into alexa.amazon.com . Create a .alexa.cookie file in top, so that the filepath looks like this:

    Code: Select all

     /tmp/.alexa.cookie 
    Once you have the cookies.txt, paste that information into your cookie file.

    Once again, you can create a .alexa.cookie file by going to the /tmp directory with and then using

    Code: Select all

     cd /tmp 
     nano .alexa.cookie 
  • Now we made to make this file an executable, so we can run it in our terminal.

    Code: Select all

     chmod u+x alexa_remote_control.sh 
  • Now you can run this command to test it out and it should print out a list of devices like:

    Code: Select all

     sudo ./alexa_remote_control -a 
    https://imgur.com/qC4wlGc/

    You can also try selecting a device and making it speak with

    Code: Select all

     ./alexa_remote_control.sh -d "<MY-DEVICE>" -e speak:" This is a test!"

Return to “General discussion”