[Deprecated] Amazon Alexa Text to Speech (TTS) v0.6.2 - Direct Integration (USA, Canada, UK, Italy, Australia, & Brazil)

Well the Pi user has full root access to PM2. I can open a terminal window and enter pm2 restart AlexaCookie (and it will restart).

Edit: let me redirect the output from crontab to my desktop to see if it runs.
30 2 * * * pm2 restart AlexaCookie >> /home/pi/Desktop/out.txt
Will give this a try.

Then it should restart. When you run "crontab -l" as pi do you see this cron job listed? And, have you confirmed that crond is running?

Yup

Yup service cron status is active (running).

Thanks! I'll look into adding volume control. Looks pretty straightforward. Just need to find some free time.

The original attempt was by another community member, but I could never get it working correctly. So, I just yanked out all of that code this morning! :wink:

Does anyone else find dealing with the lady in the box annoying? With the latest version, I can see that one message is sent from the Hub to Amazon, but randomly the devices still give the "Sorry I'm having trouble understanding now, please try again later" error. With the change to announcement in the code, I can see that each tablet gets the words since it displays on the screen.

Is the flow such that the tablet would receive the message, then reach out to Amazon to grab the audio to play?

Thanks

I have never used a Tablet to run Alexa. Works fine on the physical Echo devices.

I'm out of ideas. Just one last question - are you directly putting that command in the crontab, or are you executing a shell script with that command from crontab? I actually do the latter.

In the olden days, cron didn't like spaces in the command, and I got into the habit of executing shell scripts from cron. I thought that was fixed a long time back, but who knows ....

Thanks @ogiewon, I replaced my hacked version with this so I can more easily stay current with future changes.

1 Like

Work great so far here! Thank you for the change.

1 Like

I’m putting it directly in crontab. I can try having it call a shell script file instead.

So I redirected the output and it did create a file at 2:30 AM but the file is empty. Is that to be expected?

No. Create a shell script like this and execute that via cron:

!/bin/bash
/bin/date > /tmp/alexacookie.txt
/usr/local/bin/pm2 restart AlexaCookie >>/tmp/alexacookie.txt 2>&1

(replace the path to bash, date, and pm2 to be appropriate for your system).

The output from this should look like this:

Fri Jan  3 10:28:01 CST 2020
[PM2] Applying action restartProcessId on app [AlexaCookie](ids: 1)
[PM2] [AlexaCookie](1) āœ“
ā”Œā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ id │ name                    │ version │ mode    │ pid      │ uptime │ ↺    │ status   │ cpu      │ mem      │ user     │ watching │
ā”œā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ 1  │ AlexaCookie             │ 0.1.2   │ fork    │ 26284    │ 0s     │ 32   │ online   │ 0%       │ 3.9mb    │ root     │ disabled │
│ 3  │ DoNS                    │ 1.0.0   │ fork    │ 1411     │ 29D    │ 0    │ online   │ 0%       │ 49.2mb   │ root     │ disabled │
│ 2  │ harmony-api-app         │ 2.3.5   │ fork    │ 1405     │ 29D    │ 0    │ online   │ 5%       │ 59.1mb   │ root     │ disabled │
│ 0  │ sonos-server            │ 1.6.9   │ fork    │ 1391     │ 29D    │ 0    │ online   │ 0%       │ 76.5mb   │ root     │ disabled │
ā””ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

The node services you use will be different, but AlexaCookie should be the same. I put the date command to get a timestamp and confirmation that the cron job ran. And the output from pm2 is redirected to the same file.

Edit - make sure the shell script is marked executable. And put the entire path to the commands.

1 Like

@ogiewon, I just sent a PR that adds a simple override switch that allows enabling/disabling TTS messages. ie: "Alexa, turn off voice announcements"

I need a better name for my switch since Alexa misheard me once and thought I wanted to send an announcement

1 Like

For some reason "AlexaCookie" stopped running as "pm2 list" had an empty result (thus the bash script didn't execute correctly) so I relaunched the application by performing the following
pm2 start AlexaCookie.js (when in the "AlexaCookieNodeJs: directory)
pm2 startup
pm2 save

The cron job will hopefully run tonight and I will report in the morning if it was successful.

UPDATE: it worked! Thank you for the help!

1 Like

So I get to the point where the Alexa TTS Manager app is created, it sees all of my echo's, so it clearly authenticated, and it creates devices for each.

When I try to send text, I always get:

  • groovy.lang.StringWriterIOException: java.io.IOException: Stream closed on line 40 (deviceNotification)
  • 'speakMessage()': Error making Call (getMessage): Bad Request
  • 'speakMessage()': Error making Call (Status): 400
  • 'speakMessage()': Error making Call (Data): {"message":"Input failed to validate."}

and, unsurprisingly, no sound comes out of the Echo in question. :slight_smile:

Nevermind!

I was logged onto my account, not my wife's account. Needed to be on hers.

1 Like

Hi everybody!

I'm wondering ... can I use this app even if my environment and country is different than the supported one? I live in Brazil and I don't mind getting my Alexa speakers alerting me in English. This functionality is so interesting - and important - that I don't mind even if it alert me in Sanskrit !

Do you have a US Amazon Alexa Account? Or Brazil Amazon Alexa account? The code does a lookup based on the country you select, and then connects to the corresponding country's alexa.amazon.xxx web site. So, I believe you'll need to have an Amazon account in one of the supported countries.

However, adding additional countries is not too hard. Are you a programmer? If so, take a look at the Alexa TTS App's groovy code. There is a list of countries and their respective web sites. If you know Brazil's, it should be pretty simple to add it. No guarantee that it will work in Brazil, though... :wink:

2 Likes

Hi @ogiewon !

I did the update at the Alexa TTS app code to include the "Brazilian" Alexa.

Guess what? It worked! This is really great !!!!!

How can I send you the updated code so you could put it in the repository?

Thanks for the tip!

1 Like

Fantastic!!!

You can simply copy and paste it into a Private Message and I will update my GitHub Repository (unless you are already familiar with GitHub Repo Forking and Pull Requests, as that would work as well.)

@ogiewon

Have you started hearing some text prepended and appended to text sent for TTS?

Sounds like "Amazon force unit selection" said at each end of the TTS message.