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

Thank you! @gabriele. Working again now without errors. I appreciate the help.

When I do it all manually it works great. When I try to put the raw cookie from the nodejs Alexaxcookie app it doesn’t work. Logs show index out of range cause it can’t get the number of Alexa devices (at least that is my theory).

Could you post your logs?

app:4912019-01-23 07:44:12.152 pm debug'updated()' called

app:4912019-01-23 07:44:02.560 pm errorgetDevices: error = java.lang.IndexOutOfBoundsException: index is out of range 0..-1 (index = 0)

app:4912019-01-23 07:43:51.184 pm error'refreshCookie()': Error making Call (getMessage): Bad Request

app:4912019-01-23 07:43:51.183 pm error'refreshCookie()': Error making Call (Status): 400

app:4912019-01-23 07:43:51.177 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:182:13) at endReadableNT (_stream_readable.js:1094:12) at args.(anonymous function) (C:\Users\USERHERE\AppData\Roaming\npm\node_modules\pm2\node_modules\event-loop-inspector\index.js:138:29)

app:4912019-01-23 07:43:51.127 pm infoAlexa TTS: starting cookie refresh procedure

Seems that options have wrong format. In refresh cookie I simply send entire options content as JSON to Node service, seems that you have a malformed JSON in options

So i been playing around with this today. i figured out my problem. line 188.

    def csrf = (alexaCookie =~ "csrf=(.*?);")[0][1]

This is the RefreshOptions from NodeJS App (i did invalidate them):
{"loginCookie":"session-id=140-6532892-3088116; session-id-time=2178634445l; csm-hit=tb:9G6FS98FQ7V57B0NQM6C+s-9G6FS98FQ7V57B0NQM6C|1547993801405&t:1547993801405&adb:adblk_yes; ubid-main=132-2682681-9835468; session-token="H2UbTugOEkfwND0/C6irD2vXAPeERNHqb7U6w+P0XrAdS+INwvvd4MlSrgHMNmUDUGRLv4Z67ULnWoDp+aD+uAUo5EZVU8DNtJ/DV0S8lVS9M2puFP+UnEZRCjIHAkXuN9GPiv5LuCKzT/5AXeeK7eTxaggBSbsrOLA6yMDqiVlkamJTMGGZMsd872NsHeWmELoAHHleD0toT8VMLj3Ud+HQQBPNDIQJdpVIKCbJ+bE="; sid=Uvp/l/YfdKWoEDEeFJFMfg==|+xNxeKdIz7CafQkowUrEjg1jhyE4S0R5N0f9oZJr1/0=; x-main=vMs6VADntIzx7JOGkmShrmN7K4pbrYgR; at-main=Atza|IwEBINfCwiZmZxZMDKk7BeMt2SUMmP4Fm-hqR8eDcEIfgiqoh-oioJQHAe3DAcRF3mJ4-8IFd_OB9onohW96Vxif-hO0VjJjLWGVS9JQi1c327jqReLy1tnNDzBsrG46SGxDo1cgGd8Nu2cH-Wuy7Ipsnz4Egps7Y9-thmmfC-XuZITYx452G8IKBCfoCyXMS8aFUKhHY7PSn0amze-nrhpaLqj9q_eRi_YNUiiiLq68XcvE9Ga1q1TwLVR506KB0FqLtso5MyqMPVCIgjvTbrveALuBHFhZ9UZr9y0jtydBkh3UNhQt80QAq8DM6k_IT8ToQ_16GCw2MSNQvrIGe9Q97UWCiBMBrajid3emBqolyMy_JcWxB7fOrsxNx3LbfQ4yx0GvNrHC3U0fiI-oIEYh_OZnM2h3PouO9vt-K0rId8piZg; sess-at-main="1PNxvUtmzV4blhvUrbaAD8L7tKiKCkvcjsREsFdP0NY="; io=VpcgwmV3M0NSY_mAAAA_; frc=TAHKYVxPaushYZH9Z6IEtIjB2ZMVTURQsSU8YoIS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2aWNlX3JlZ2lzdHJhdGlvbl9kYXRhIjp7InNvZnR3YXJlX3ZlcnNpb24iOiIxIn0sImFwcF9pZGVudGlmaWVyIjp7ImFwcF92ZXJzaW9uIjoiMi4yLjIyMzgzMCIsImJ1bmRsZV9pZCI6ImNvbS5hbWF6b24uZWNobyJ9fQ==","deviceId":"404052845545418135082585506401518331703580060706837305405755681323413249564c5635564d32573831","deviceSerial":"50deb6aca2f8bc5c5e6f1562ce9a05a4","refreshToken":"Atnr|EwICICti8enI65JFGgCIiZl5aDgsNG3eIgt9scg-OAIj8isU6NYOp6N747sgok5cwGMNZ_yaOxuGQwe2sUyRRUQdtxgduuDgrU3m5xFv1s3UVSvVwQNCWP9Bx_cq7bHY7U_hb0Q7-kp9x7Pok7EqqmsaaqLVZLBeZ30ZT1UW6ouTG-hhmC98D3exjgFGQuTtgSeydQ9HJ559XG9_BeoziYJ0urkg2fgNWOfWzWsQufSlFKvN3BRmGfsuG-wPecu91eoWyMHEvm9PKIC1mvI6iTAvOygLbPNcRxCoklcIyMmQ5prW8jWVutyofCuiOYXHc90n4yNbBX__a4yrD6inJFH9GVrSbyx-L3zYbwBYsIxUch3sboM_yCD6rRwX5zxwEiFMrOM","tokenDate":1549225992125,"amazonPage":"amazon.com","localCookie":"session-id=147-9852609-3452554; session-id-time=2179945992l; ubid-main=134-0831594-4886160; x-main=0zkmB2FZAo2S6NRywpQUa5v4tjZfWvbe; at-main=Atza|IwEBIKTsuX8BjjMshK2E4wEK5oLj4ExRUmnENHP9_EWWkoNXG_EEiMRqH20wzXfO-f2psYh8bxq4vahYIYTiVBH96fLuf3cIG3r4caz2NyVANryKrfIoRncVo7WO5RNKEnUj74kkEgTpG7S4nt5yTSCJTzLcv5UNta_RyY3Ze8LKwPu4iNkpSAjjytCBvgF2Goe62WvMIV8DCKzguH_o8K-PV5sxTHMdJS5r9zum935Sk-kfWvipk6Pk_JbXmJBKJ3uo-5IngmaYuCfq8FvEXgoZkGcvVtrCwwQ2_YrksDIn9fdtkd9lcsdpCaV5xNXY5dMHv0-Z693tjrRfbRaHDjZ5fjDwAd9n5d8rK3IaG6qfsePSnWLDDnECEzLSw_j_DlmdYiojJqVbbKBKroO-yyVCo7YBZVo3GdxT0y_OO0hzw-7sqxh8PHXxJdh9C4LI2zkfQxasTCkj-QwbAhz5jX2Hof6q; sess-at-main=XyPnh8FGGZKtaNh/E89ZDcqGOFBTLqzmb9jruGxxsAM=; csrf=-1538640173","csrf":"-1538640173"}

Here is what my normal login cookie loooks like pulled from Firefox:
Cookie: session-id=137-8490857-5575109; session-id-time=2082787201l; x-wl-uid=1ppC6d4ytAeXcp4E/d7KeyRsk5zsvhZu+iLNGF0hKNNHjh61e5yp2dFOzhirxaPX+pRkbnccJDVi1AvSseB+FtXK72c9yhIfKfUVEph+lWqXUlxdz1CLqfu2w9drAQ18EXBMSwIpxgO8=; ubid-main=154-9149903-9653617; session-token="pru28fOx2+Dnrl13qxVPPs93rZvM3UXWsZSEAnziJIinFNwzsQkJ7SVPi0fOlf9valTXyX0mYT5W/pc4qNR5KFX0uP76yG7ODT/8ZXH/JKlfTi/FIKnGZl3601qS5iw0frRklKxruJa3uPUmRRtG4FODOH13O2G0/TU+lfGB0p/63t7iUwFl6/jvJ7r9OzGkj7OWoys1uRbWSM6kQwoGLDP6Mw8AzZ/OnmSOAFZLUl4="; sid="QqeRmshd6y3kEvA4bLtpPA==|+aW/gdZBdNHtBEBHSFNsWwYQsvZVkCSafDX0eK++Scc="; x-main="EcVNU0@MSLL@xZ0N@IUnOR11q6AcvaBI"; at-main=Atza|IwEBIKQdNHWbD7foLke1BN0K8cXW_cpcl3KE4VImDXm4bcA3JuP1llk1bD1rB9y3UihU8TRqdhDu-TAJiCWCC4PdwcTHepMB-yo82r6VD1l-kieo07o4qhtJiRlIoE1NlHSGxuIMNBXuFYL4piCWKiItvbaI1UQEAnLkb0d8g6OFk_oOZMdY4loy7xnPjWbCawQEt8GDyKfCVFHxJ_FAp2FFsw0MO9A3rjwaBqYvDl0PVwzA8tpPiF0e0JDokZZuz1O8fzdMd4GuW98IxwVPOVD9K8s1pl10IZlR82ggHIFRQwTZGRrxU2TJiYnsXUxlGwx8t1oGsT2nDf281RfYz37yxyPRaxE8HkiCbjhtlTPsxYuUF_xiTx_nE4zH0zerc0U7upUcxZByGDyJcQ48LAifwnPlPmy9XMCvGuKNRDSn5Zq8Ww; lc-main=en_US; s_nr=1547327446148-Repeat; s_vnum=1943655246150%26vn%3D7; s_dslv=1547327446149; sst-main=Sst1|PQGzX2Mj5vfbiHHczIUdD7emC0FeHfw94vBE50hXUYXzyDMcufjpGPW68lsFDieOkn7WguDOu0GOJtDLN3PbISTeztFyBrU6b4kFMNMv2_DZsUHzRmFnDmIvXk0RWtEyOXPMAFKJrZjneIIigx1f34b8361kvyp6xHuTS9uBWB3cwvb-L1ZBOwiduSf_xOR6X6dfI3rxoJ0KtxOFTTPMkdSxPOyIhVtWgM_SQ_r4IJ0q2AwanyY90nboDW_7xuzow9g76fEb2Vy_fP7Jtro9uu75nYQ-liuXw88Rt3yfVhafhXMNlSxjUSLyZnOEqeyMPUHmaeeO_jH006YI8yTq1B0HOQ; sess-at-main="4nm5x9EjwU7xTKbw4Gbs85VNKKel0PL53rl83AgroxQ="; csrf=-1787090293; i18n-prefs=USD; skin=noskin

So at this point is my nodeJS server messing things up? based on what i learned in the last 10 minutes about groovy that should be valid (first or 2nd)

Thanks,

@ogiewon, is this accurate? I disabled Alexa TTS temporarily while I troubleshoot my hub but planned to add it back. Say it ain't so!

I just tested mine and it is still working fine. I haven’t had to manually deal with the cookie for weeks thanks to @gabriele’s additions.

I just installed this today and it works beautifully. I have 5 echo devices and it works with all of them without any issues. My cookie string is super long but it pasted in without any problems. I will try to get the Node.js updater installed next. Thanks for much for making this - it is super useful. I actually have Sonos devices too but this gives me added flexibility to speak in rooms where I don't have speakers located.

2 Likes

Hey all,

My cookie expired the other day, I entered a new one and now I am getting this error

Thoughts?
Rick

Still working fine here. Are you sure you didn't invalidate the new cookie by logging out of the amazon web page?

100% sure, however something even more stupid

The cookie came from my wife's account.... frick

Working now
Rick

1 Like

All,

I have just released v0.5.1 which addresses an exception that was raised and caught each time a TTS message was sent to Amazon. The exception was thrown by the underlying platform while trying to process the response as json. Working with support, I have changed the expected contentType to text/plain and the exceptions appear to be resolved. Hubitat Support noticed this error while troubleshooting various users' hubs over the past few months.

Please upgrade your Alexa TTS App to v0.5.1 as soon as possible to eliminate this issue.

4 Likes

Does anyone know why this does not work for Australia? I have added the following without success: "Australia": [Alexa: "alexa.amazon.com.au", Amazon: "alexa.amazon.com", Language: "en-AU"].

The app finds and lists my device, and installs the child container. Everything appears working, except no speech ever comes out of the Alexa Echo Dot. The log shows:
app:1022019-03-16 18:43:33.835 debugSending 'This is a real test' to 'Ben's Echo Dot

dev:332019-03-16 18:43:33.805 infovchild received infoBen's Echo Dot

dev:372019-03-16 18:43:33.780 debugSpeaking message = 'This is a real test'

Any suggestions?

Do you have DND enabled for the echo device(s) ? It won't speak if enabled.

The latest version is always in my GitHub repository, linked with in the first post.

Thank you for the prompt responses. To answer the questions asked:

  • DND is off.
  • I am using the latest version off GitHub, namely 0.5.1.

Any other ideas?

I just set this up using the method of grabbing the cookie from the browser developer tools. This is fricking awesome. I love it. I read through the part about setting up a nodejs which is more then I feel like getting into this morning. However I do have a pi running my VPN server where I can probably host the nodejs as well. Good stuff.

1 Like

Working through the nodejs install for Alexa cookie.

Done and done!

2 Likes