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

@thomas.c.howard I have temporarily removed the "volume" feature from my GitHub repository as I can no longer make it work, whatsoever. If you find some time to debug the changes, I will happily look into adding them back in. I just don't have time right now to debug why it no longer works.

I am taking a look at it now. For some reason, playing music on that device “restores” the ability for a time. Strange.

Thanks for removing the functionality. I will investigate and see if there is a reliable path forward.

1 Like

@csteele have you tried this method for the Alexa cookie:

Hi everyone. First time user. Setup went like clockwork per documentation. When I initiate a 'speak' command from the child device, I get the following in the logs:

'speakMessage()': Error making Call (getMessage): Bad Request
'speakMessage()': Error making Call (Status): 400
'speakMessage()': Error making Call (Data): {"message":null}

I've seen references to this error in the past but the resolution is unclear to me. Can someone steer me in the right direction? Thanks!

Welcome to Hubitat! :smiley:

The 400 error means that you're not authenticated. Did you add your cookie to the app settings?

Yep. I copied the featureaccess-v3 request headers from Chrome per the docs. It accepts the cookie and displays a list of the echo devices associated with my account. Does that not indicate authentication?

Yeah, it does. Are you sending a speak command to an individual device or a group? The only time I've seen a 400 error is when I exceed the Amazon rate limit.

Individual Echo Dot. I have multiple on the account, but for testing purposes I've only enabled one for the app. It shows up on the device page as expected. I can enter a string in the text field but the "Speak" button doesn't result in the string being spoken, only the error I pasted above in the logs. Not sure if that helps...

Would it matter if the account is part of an Amazon Family? (mine is)

Technically it shouldn't matter. Mine is part of a family as well.

I'm going to throw this over to @ogiewon as I can't replicate the 400 error. I've tried speaking weird strings (with non-alpha characters) and also changing my cookie and still can't reproduce it. :frowning:

Cool. Thanks for the help. For what it's worth, the string I was putting in was "test". Nothing fancy going on here... :slight_smile:

I figured as much. Can you try with another device as well (if you haven't already)? Maybe it's something to do with just that Dot? I don't currently have any Dots on my account.

Is your account the Primary user account for the Amazon Echo/Dot/Spot/Show/etc... devices? I'm not saying that it needs to be, but that might be it...

It definitely seems strange that you can retrieve the list of Alexa devices, but then cannot get them to 'Speak'...

I got it to work finally, but the resolution is less than satisfying.

To rule out anything odd on the Amazon account side, I deregistered/reregistered the Dot I've been using for testing. Now everything is working properly. To answer your question, yes the Dot was registered to the Primary user account (mine). That didn't change when I de/re registered. shrug

I guess turning it off and back on again cleared the problem. lol

2 Likes

ok i been trying ot get the auto refresh working again. I am having no luck.

Using latest version. When i do the cookie via the browser it works great. Anyone have any ideas?

Here is the info i have:
refresh options in browser window:
{"loginCookie":"io=LG5mXDK0-rJXL3dMAAAA; frc=VeZ3bwjixDwBo4OljvkZBmCet5GU3EsNfIKGEUychzjDcFanxmSKn9i2drsosCYImZ8fkuakUO46TpeqeV83P/R+VNZb6uFjm++IfTyL4OnUp/CKB4EC4qNZg6SByubWJRD9ZFgaTNfVB7970a9fL3JVZO0XcUGpF48RLhUEOoIitKVrVkFxXkMRmRhobsLk5azxYHOCCfJWVyWT517Q/gFx8KMyaIlGkukoWmMuJz1M76uGdT8s+XI7g3l0auw+ZT7lTx2X+CID7ASo/DxcX1lKRQh/mF1Eo72p8C7NOPPU7zKJxN6qMo+PFzoawLsT26+fTzjkDHJGykiuP7vb3jiMYEaAA0EKQavqtBIYWwVPbfo9iS1XN+LsIEKKoUc8TJrU96eu2z5VU74DDGwMg2S8Cj9qpY7JhQ==; map-md=eyJkZXZpY2VfdXNlcl9kaWN0aW9uYXJ5IjpbXSwiZGV2aWNlX3JlZ2lzdHJhdGlvbl9kYXRhIjp7InNvZnR3YXJlX3ZlcnNpb24iOiIxIn0sImFwcF9pZGVudGlmaWVyIjp7ImFwcF92ZXJzaW9uIjoiMi4yLjIyMzgzMCIsImJ1bmRsZV9pZCI6ImNvbS5hbWF6b24uZWNobyJ9fQ==; session-id=137-4493612-8570936; session-id-time=2187125215l; csm-hit=tb:D1K9218E9RRE5QPR2QYZ+s-D1K9218E9RRE5QPR2QYZ|1556405217389&t:1556405217389&adb:adblk_yes; ubid-main=133-2095874-9288643; session-token="sh24B6x1xIeD32DkGeCZ886Sgznklkhhq9jgK825Al+B2lk3M+RO2loNTXXRDH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OPPU7zKJxN6qMo+PFzoawLsT26+fTzjkDHJGykiuP7vb3jiMYEaAA0EKQavqtBIYWwVPbfo9iS1XN+LsIEKKoUc8TJrU96eu2z5VU74DDGwMg2S8Cj9qpY7JhQ==","map-md":"eyJkZXZpY2VfdXNlcl9kaWN0aW9uYXJ5IjpbXSwiZGV2aWNlX3JlZ2lzdHJhdGlvbl9kYXRhIjp7InNvZnR3YXJlX3ZlcnNpb24iOiIxIn0sImFwcF9pZGVudGlmaWVyIjp7ImFwcF92ZXJzaW9uIjoiMi4yLjIyMzgzMCIsImJ1bmRsZV9pZCI6ImNvbS5hbWF6b24uZWNobyJ9fQ==","deviceId":"850768238548124736465503871617830872013175411314106517720886323523413249564c5635564d32573831","deviceSerial":"40f2ade2547bb0f7b5196cb9d731f0c0","refreshToken":"Atnr|EwICIPGNsdfGp2tUGjDfbuhq4FrJrKfJz3kzLHIUR4d_HKOPDDRnqj63ICY111KJD2o92oPi41wVOb3cGUcuBcYvMa20Gb0AFUSpiqIAl7XZnCV0StYXA-38TsnnlCtlLMw0_jSdoM_vIu3QW9yPrwrcUE7r1_HdNB549dMmXY3OrWAXMwe9UbL_4HXVwmMKRVIdCWoovXKwYbSnEgQ9kNnXGoGXDaeN5yzvi1s_6lTKO-FvRgNahiPkGnCd9ZlKLu_Sl7DZCQIdN-3VAt-JvahMwukxvuQlkswekcGuew2hzzFUvq5CU9ev-9DpoElx3O-jIiJ-NSCvj29fG-06xdsak1Yrb0QcxPET_dBDBsWhqHBdbGJolBRAfXCjwVbS06aaoPGIrU7M9F9e8WS47sYuYI_jMhS3WgiZNTsHUWDZrFwHfYvkan0WstMq54FbwUNTig0","tokenDate":1556405237882,"amazonPage":"amazon.com","localCookie":"session-id=145-5061037-2849804; session-id-time=2187125238l; ubid-main=132-4421658-7914967; x-main=kTBpwFQ309nurKesR3c9Znr2SmiISbrP; at-main=Atza|IwEBIHiui-RYGwQECKIo_lSGdP9NwbOtKNiM3DDeBHh-e0wf29ZEYkMjSHiuNdOR2Dt5duK7nf70M07r-HZ5DG2_fk6_LtDa2Z4xv7W-Sd4cd5uHE7fRGamB_LalR4Me8QL_gzW9boBTSYtShIxz47bhhpKYNbiHaTlUwrNqXDUNZ8xLR3rsYqW0ilkziG1pfXT48lfID8pvR3yskD_zXZg7bwCMlefIDandKwf4mLLuXOwvKGWPOhehdZMxlyPpKZQa4bySCl8oqyyUJsqTrsEjQO5i0RO1bqIl6qzFU_3b3cqNIzr8wQ6oLN4np7QpbtQQhNuUutkSP_Pq8FznS0fzpB5iO9ten8x5VGQ5sn9Va4FdPBDoClxhGf4b6zrqhKLseeRl1tGg2euNddmkiy_dmgk8VrqOyMDRyLBxWDKR7b7RdDg3j9FFzcacb0AVttCRDu6bW_Xjs0wMYUEI3yMqOKNo99seT39FDE31PbUIYh1j2w4M9kdBwDB8LljijFmXapIl2syjVCBJz46fhA2HUzMp; sess-at-main=TOkUlBpzsMylrrXZwrpLD/dlzskBQXfyXuv5EsIITsY=; csrf=-858471949","csrf":"-858471949"}

error i get:
app:4912019-04-27 05:47:49.323 pm error'refreshCookie()': Error making Call (getMessage): Bad Request
app:4912019-04-27 05:47:49.320 pm error'refreshCookie()': Error making Call (Status): 400
app:4912019-04-27 05:47:49.314 pm error'refreshCookie()': Error making Call (Data): ErrorSyntaxError: Unexpected token 5 in JSON at position 0 at JSON.parse () at createStrictSyntaxError (C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\body-parser\lib\types\json.js:158:10) at parse (C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\body-parser\lib\types\json.js:83:15) at C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\body-parser\lib\read.js:121:18 at invokeCallback (C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\raw-body\index.js:224:16) at done (C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\raw-body\index.js:213:7) at IncomingMessage.onEnd (C:\inetpub\wwwroot\AlexaCookieNodeJs\node_modules\raw-body\index.js:273:7) at IncomingMessage.emit (events.js:194:15) at endReadableNT (_stream_readable.js:1125:12) at process._tickCallback (internal/process/next_tick.js:63:19)
app:4912019-04-27 05:47:48.811 pm infoAlexa TTS: starting cookie refresh procedure

I just found out that my Zolo Halo will now work with this app! Not sure if it is already on this thread but I know that in the past only Alexa-made echos have worked!

1 Like

anyone have multiple dots and some dont speak sometimes? i have alexa annouce washer/dryer done and sometimes 1 out of 4 will and sometimes all will. its so random

Amazon only allows 2-3 devices to talk at a time. If you add more than that, you’ll get unpredictable results. If you add a delay between speak commands to each device, you should be able to avoid the problem.

1 Like

I'm having a lot of difficulty in getting my cookie entered in correctly. Can someone please direct me to the right location? I have the Refresh URL and Refresh Options, and in the App I've just copy and pasted the entire Refresh Options string, but it doesn't appear to be working. One thing I noticed is in the app it says it ends with a semi colon but mine is really long and ends with }. I know I'm missing something here. I'm getting push notifications that the string is incorrect as well.

Logs show

Let's start with the most simple method first, and then you can try using the automatic cookie refresh method.

I'd recommend removing the Alexa TTS App (not the source code, just remove any instance of the app you currently have.) Then, add the Alexa TTS app again. When prompted for the Cookie information, use the following method and ONLY populate the first field for the cookie (i.e. ignore the automatic refresh options for now)

## Method 1A - Get the cookie directly from Chrome. (Thanks @krlaframboise and @ritchierich !)

1. Open Chrome and Login to alexa.amazon.com
2. Open the Chrome menu at the top-right of your browser window, then select Tools (More Tools) > Developer Tools (or click F12)
3. On top row of developer tools you will see several tabs: Elements, Console, Sources, Network, etc. Click Network.
4. Just below the tabs you will see a red circle, below that you will see a filter box, and below that you will see sub tabs: All, XHR, JS, etc. Click XHR
5. Click Smart Home in the left navigation
6. The developer tools XHR list should populate with several items, one called "featureaccess-v3", right-click on it and choose Copy, Copy Request Headers. This will place it into your clipboard.
7. Paste the cookie into the app

I would also still add your Notifications device at the bottom, as that helps to know if there is a problem.

See if you can then click to the next page and select your Alexa devices. After they are created, see if you can go into their details pages and send a test Speak command with some text.

If that works, then you have the basics correct. You can then attempt to follow @gabriele's ReadMe for the automatic cookie updater NodeJS app.

3 Likes