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

Also mine stopped working.. Honestly I don't know what else to do..

At least it is a consistent problem. While the solution may be elusive, it would be more complicated if it worked for some but not others.

1 Like

I honestly don't think there is anything we can do. I think it's something with the amazon account and the cookies amazon returns for those users.

I ended up changing Echo Speaks v3 to auto refresh every 3 days now and added it some collection of data to tell the user why a token was invalidated.

Hopefully I can find something we've been missing.

1 Like

All,

I did some testing with the cookie refresh and @gabriele AlexaCookieNodeJS today and found an very interesting pattern.

The cookie refresh works twice. But the third, fourth, fifth refresh fails and the CSRF value is empty. Breaking TTS.

But here comes the trick, a simple restart of the AlexaCookieNodeJS app fixes the issue. You don't need to re-register again. All you need to do is to run another refresh. I haven't found the reason in the code yet but there is a very simple workaround now that people can use. @aaiyar was patient with me today and was able to verify that the workaround works! Thanks for testing with me!

The workaround: Just schedule a daily restart of the node app and you should be golden. The Alexa TTS Manager checks at 2 am in the morning if there is a new cookie. So you can restart the node app at anytime during the day or evening.

I am just going to add a cron job on my rPI that is going to do that for me. At least that keeps hopefully everyone going while I keep digging into the code to find the culprit....

4 Likes

Thank you for coming up with the fix. And I can verify it works. It actually solves a second issue.

After the first cookie refresh, I used to get errors if I used TTS on 2 different echos for the same message. I can do that now with no errors.

I was coming here just to say that I've been able to make it working after a server restart and I've found that Dan you already discovered it :sweat_smile:

2 Likes

@ogiewon so within the last 24 hours my cookie finally stopped working. I haven’t touched the setup in months. I guess I need to catch up on the recent fixes!

1 Like

All you need to do is periodically reload AlexaCookieJs. I do it daily.

1 Like

Thanks. I ended up restarting my NodeJS container (I use docker on my NAS) and it fixed the issue. Curious do you automate this restart? If so how? I’d love to do it via RM or NodeRed if possible.

With NodeRed, it's easy. Use an Inject node, Exec node and 3 debug nodes. If you have the nodejs app running in a manager like Forever or PM2 (my personal choice is PM2), then just issue the command. If it's running on another server, then you'll want to ssh -e [user]@[host] '[command]' to do it.

You could also schedule the reboot in a cron script as well.

( Sorry to hijack you @aaiyar :frowning: )

3 Likes

I use PM2 as well, and just have a cron script that runs "pm2 restart AlexaCookie".

3 Likes

Looks like fixing this could solve the issue without reboots needed?
Unfortunately it hasn't been merged yet, I'll try to send a pull request

I think I tried that and it didn’t work and I still had to restart...

1 Like

Thanks SO much for the hard work on this, I've got it working great following those nice step by step directions.

1 Like

Needed: An Idiots Guide to Getting the AlexaCookieNodeJs Running on a Raspberry Pi Model 3+ with Raspbian Buster

I’ve been piddling with this for way too long. I’m pretty sure there’s something I’m doing wrong or missing and just can’t figure it out. I’ve gone through a bunch of permutations and OS reloads and never get the webpage to load. Here’s an example of one of the install tries:

#Install the most current version of nodejs

curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -

sudo apt install -y nodejs

#Install the Alexa Cookie NODEJS wrapper for Hubitat

#Download and extract

cd ~/Downloads

wget https://github.com/gabriele-v/hubitat/archive/master.zip

unzip master.zip

mv ./hubitat-master/AlexaCookieNodeJs/AlexaCookieNodeJs/ ../

rm -rd hubitat-master/

#Configure

cd ~/AlexaCookieNodeJs/

chmod +x ./AlexaCookie.js

#Install pm2

sudo npm install -g pm2

#upgrade to latest npm

sudo npm install npm@latest -g

#upgrade to latest pm2

sudo npm install pm2@latest -g

pm2 start AlexaCookie.js

pm2 startup

#result script from the pm2 startup

sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

pm2 save

At this point I’ve been skipping setting up the cron job to restart daily. In some of the variations I’ve even put in :

sudo npm install -g body-parser

sudo npm install -g cookie

sudo npm install -g express

sudo npm install -g http

sudo npm install -g http-proxy-middleware

sudo npm install -g http-proxy-response-rewrite

sudo npm install -g linkifyjs

sudo npm install -g querystring

sudo npm install -g socket.io

sudo npm install -g uuid

OR

npm install body-parser

npm install cookie

npm install express

npm install http

npm install http-proxy-middleware

npm install http-proxy-response-rewrite

npm install linkifyjs

npm install querystring

npm install socket.io

npm install uuid

Since at times I see “Error: Cannot find module 'express'” in the ~/.pm2/logs/AlexaCookie-errors file.

Assuming a clean install of ‘Raspbian Buster with desktop and recommended software’ but updated with ‘sudo agt-get update’ and ‘sudo apt-get upgrade’, can anyone instruct this poor, tired fool what actually needs to be in the bash script above to get it working correctly?

Thanks,
Bill

I felt the same way. Never got it working correctly.

I then saw that Spotify had a deal to sign up and get a free google home mini. So I signed up for a $10 account and got my mini. Cancelled afterwards.

Then I ended up with 30 kohl’s cash that was expiring and got a 2nd one for 10 bucks cause it was on sale. I have Alexa all over the place in the house but I only need tts in 2 places and it’s ultra easy with google home mini.

1 Like

I recently went through this process using a RPi 3 B+ running the latest version of Raspian Buster. I was able to get things working again, however I did use NodeJS v8 (not sure if this is required or not, but that is the version of NodeJS I have always had the most luck with. Raspian Buster's repo default version is now NodeJS v10, which makes getting NodeJS v8 installed a little tricky.) I will try to find my notes and write something up specific to the Raspberry Pi platform, and then submit a pull request to @gabriele's GitHub repo's ReadMe. It might take a day or two before I can get to this, though.

2 Likes

@billmeek

@ogiewon's installation notes will be more useful to you. I use Ubuntu 18.04, so my installation notes are of no use to you.

Just wanted to mention that I am using NodeJS v8 (8.10.0) and PM2 v4.1.2. I was using PM2 v3.5.0 - there are huge improvements in memory usage between these two version (v4.1.2 is much better).

1 Like

tomm1313,

I'm pretty invested in the Amazon ecosystem. There’s an Echo or Echo Dot in every room of the house including the bathroom and storage room. I’ve even added an Echo Auto to my 2008 Smart Cabriolet (convertible). So rather than just setting up a ‘smart house’, I’ve got a smart Smart car too.

A gripe about that… Amazon’s lockout on their microwave means you can’t start it via Alexa if the door hasn’t been open in 10 minutes. That defeats one of the reasons I bought it. I planned to put a frozen meal in the microwave when I leave for a service call and start it heating on the way home. So when I walked in the house, lunch could be waiting. It irks me that you can’t turn off that nanny-like safety and the Amazon website for the microwave says it works with my Echo Auto. Yeah, but only for 10 minutes after I close the door on the microwave. Not very useful eh?

ogiewon,

Thank you very much. There’s no rush as I’m using the cookie from the web browser currently. It’d just be a lot easier to have the cookie auto-updated as I have several uses in mind for the speech capabilities. Until I pick out a siren, I’m having HSM turn on all lights in (and outside) the house to 100% and red, along with reading the intruders Vogon poetry (Douglas Adam’s “Hitchhiker’s Guide to the Galaxy” fans will get the reference).

Aaiyar,

I’ve got an old Ubuntu file server that hasn’t been on in a year. There’s also a Linux Mint laptop setting here by my desk that I startup when needed. I could try it on them, but wanted something with lower power usage to run 24x7 and it would be good to do something actually useful with another of the (several) Raspberry PIs I have laying around. Currently the only one in real use is a RPi Zero that acts as a time server for my POE cameras. I never could get the cameras to sync time from the Windows 10 PC that is running Blue Iris.

1 Like

I run Ubuntu on an Odroid XU4, which is an octacore ARM-based SBC. Four cores are big endian, the other four are little endian. It runs everything that I need - PiHole, OpenVPNd, a DLNA server, ntpd, several nodeJS servers, sendmail, samba, backup for both my Hubitats .....