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

This all sounds good. It's seems way more simple and the architecture seems to be setup so that hubitat can still use the cached mp3s from Polly.

I'm not happy about having separate sonos devices in my house but it's worth it if most functions are working within the house.

Does anyone know how often hubitat caches the mp3s from polly?

Hubitat caches the audio clips once, and uses that cached version from then on as long as the text requested does not change, and you have not changed the Polly Voice for the Hubitat Hub in the Settings menu. The only other thing that could cause the cache to need to be refreshed is if the cache runs out of disk space on the hub.

1 Like

@ogiewon:
We just got a number of Alexa devices, so I'm trying (very late to the party), to get this working.
I seem to be having some difficulty in putting in my initial cookie data, and I get the following error message in my log:


This is what my input page looks like:

A few questions:

  1. MY amazon account is in the US, even though the devices are in Canada. Is it correct to put the US under country here?
  2. The Node JS server: that's my RPI id and password. Correct?
  3. On the input line: Raw/Edited cookie amd refresh options, I pasted the entire cookie (all ten or so lines, with a semi colon at end). Correct?

Thanks for your time.

I would think so, but I am not 100% sure. Perhaps another Canadian user will chime in?

No, those should be left blank, typically

Not exactly. Details are in the ReadMe documents.

Here is what mine looks like...

Note: I changed the port used on the RPi for the NodeJS AlexaCookie server to 8881.

the cookie and the cookie refresh should not be the same

Thanks.
I got it working by using Method #1A, getting the cookie from Chrome directly.
Thanks to:

@krlaframboise and @ritchierich

Delete both the cookie fields and then paste it in the refresh options section and it will populate the upper cookie field

for those of us that are not very good with setting up Pis, is there somewhere I can get a more detailed instruction for installing AlexaCookieNodeJs?

need more info on the hardware you are setting it up on.

oops sorry. I will be using a pi zero w. I suppose before I get into this I should ask if this is a good alternative to Echo Speaks. I only use ES for the virtual devices and I see that it is a very busy app when I look at my logs.

sorry cannot really help with that one.. maybe someone that has done it can jump in.. I did mine on a qnap nas.

Depends on what your goals are. If your objective is to use Echos for announcements via TTS, then this is the app to use.

2 Likes

And...if your goal is to simply use Echos for a few standard, canned announcements, I would even say you'd be better off simply using a Hubitat Virtual Contact sensor to trigger an Alexa Routine to play an announcement. The downside is you need a virtual contact sensor for each announcement, and those announcements cannot be changed at runtime. But, you do not require any custom code on your Hubitat hub to achieve this!

3 Likes

I'd want to be able to do a little more customization than that but I don't need any of the extra stuff that ES has. I think this is the way for me to go I just need to get a little help with the nodejs part.

normally you need to install git and node js .. usually under a docker image..

Just having some issues refreshing my cookie with the automatic method with nodejs
The server is up and running. I can hit the url etc.
Thoughts?
Thanks
Mike

app:5962021-02-19 09:45:51.916 am error'getCookie()': Error making Call (getMessage): Internal Server Error

app:5962021-02-19 09:45:51.913 am error'getCookie()': Error making Call (Status): 500

app:5962021-02-19 09:45:51.909 am error'getCookie()': Error making Call (Data): Error refreshing cookie => ERROR: getaddrinfo EAI_AGAIN api.amazon.com

app:5962021-02-19 09:45:51.874 am infoAlexa TTS: starting cookie download procedure

app:5962021-02-19 09:40:51.784 am infoAlexa TTS: Request for new cookie sent succesfully, guid: 91a3c179-9ccf-4976-ab0d-337f7c81d841

app:5962021-02-19 09:40:51.729 am infoAlexa TTS: starting cookie refresh procedure

i ve seen those errors occasionally restarting the nas the code is on has always fixed it for me. has it ever worked.

@ogiewon I'm not sure why, but every couple of weeks I get the "Check cookie" msg and I need to manually refresh the cookie - I don't even need to touch my AlexaCookie Server.

Is there any way you can automate the refresh cookie process so when it expires it just auto-refreshes itself?

The code already automatically refreshes the cookie every 6 days...

You could easily modify this to change the number of days between refreshes, or the time of day that the refresh is attempted.

The problem with attempting to automatically refresh the cookie whenever there is an error, is that we aren't 100% sure what causes the errors, and we want to avoid creating an infinite loop.

As you can see in the code... it pretty much always defaults to "Check your Cookie" for all unhandled errors that are thrown by the Amazon servers. Thus, we'd need more details about the very specific circumstances of your failure mechanism, to try and trap the error for the very specific scenario you're experiencing.

I try to keep this integration as simple as possible...and I did not write the automatic cookie refresh piece of it at all... Perhaps @gabriele might have some ideas, as he wrote the AlexaCookie portion?

2 Likes

Could you please make the Refresh time & Frequency user-configurable so if I change the time, and the driver gets updated, I don't lose the setting?

EDIT: one other option that springs to mind is having the HE App refresh the cookie once on error and if that fails, then ping the user (and dont keep retrying).