thorsten-gehrig/alexa-remote-control

Speech not working

Opened this issue · 14 comments

Hi,

This used to work up until 2 days ago:
alexa_remote_control.sh -d "Dot1" -e speak:"test"

now when i do it i get a responce:
sending cmd:speak:test to dev:Dot1 type:XXXXXX serial:XXXXXX customerid:XXXXXX
(ive removed the type/serial/customerid)

other command such as list devices and lastcommand work fine so it can see my alexa devices, just cant get text to speech, nothing changed on my side so unsire why it suddenly stopped.

Thanks

Hello Themaaft,

for me all is working as before. I once had similar issue when the Echo was set to volume zero. You can make a test by playing some music and issueing the speak command while music is running. If volume of music is reduced or not gives you some additional information to think about when looking for the root cause.

You can also test to replace speak by -e textcommand:'anything you would otherwise say to Alexa'. I used this some time ago as a workaround. Some days later, original command was working again for no known reason.

Regards,
Horst (just another user delighted by the script)

Hi Horst,

Thanks for the reply. Ive just tested what you said and no drop in volume when i try the speak command when music playing. also the other command "textcommand" doesnt do anything either, very odd. maybe in a few days it will work again?

Thanks

Hello Themaaft,

yeah strange. Do you have more than one Echo? Same issue on another one? You could also try to disconnect the Echo from power and re-connect it and retry if you didn't do that already.

Regards,
Horst

Hi,

yes tried them all, same result and yea did the power off/on trick, no jou :(

i shall try again in few days

Thanks

adn77 commented

@themaaft you could try setting your curl options to export OPTS='-v --compressed --http1.1' and see if you get a HTTP/1.1 200 in return to your speak request.

Another option would be to remove anything .alexa* in your temp folder and start over.

The plot thickens...

if i remove all the .alexa files from temp dir i of course get the expected error:
"ERROR: Amazon Login was unsuccessful. Possibly you get a captcha login screen.
Try logging in to https://alexa.amazon.co.uk with your browser. In your browser
make sure to have all Amazon related cookies deleted and Javascript disabled!"

so i re do the cookies file and with the verbose curl flag set the last message is:

(i do get a few http/200 messages but the last message is a 401)

  • upload completely sent off: 414 out of 414 bytes
    < HTTP/1.1 401
    < Content-Length: 0
    < Connection: keep-alive
    < Server: Server
    < Date: Wed, 20 Oct 2021 11:16:25 GMT
    < x-amz-rid: 35Z7GFXXXXXXXXRQXMYF
    < Cache-Control: no-transform, no-store
    < Vary: Content-Type,Accept-Encoding,X-Amzn-CDN-Cache,X-Amzn-AX-Treatment,User-Agent
    < Permissions-Policy: interest-cohort=()
    < X-Cache: Error from cloudfront
    < Via: 1.1 0d02f7d76448fc6a58a71c5efe4feef2.cloudfront.net (CloudFront)
    < X-Amz-Cf-Pop: LHR3-C2
    < X-Amz-Cf-Id: MYcf4uWg5tH1BBxBXXXXXXXXXXSSSYcA23SZIhETOgYJegZ1Vug==
    <
  • Connection #0 to host alexa.amazon.co.uk left intact

so a 401 error occurs, this happens if i do it on a completely fresh machine too

adn77 commented

What do you mean by so i re do the cookies file?
The script should be able to log you in - if all fails by using MFA at least.

I created a new login method similar to the Alexa app. For this to work you'll need a REFRESH_TOKEN.
Download the latest alexa_remote_control.sh
For your convenience I created a packed binary for the Alexa-Cookie retrieval: https://github.com/adn77/alexa-cookie-cli/releases
(make sure to adjust the parameters to your local Amazon login page).

You can read more here https://blog.loetzimmer.de/2021/09/alexa-remote-control-shell-script.html

I used to manually get the cookies file from my browser extension and paste it as .alexa.cookie worked fine for a long time

ive just setup a new VM and downloaded the latest alexa_remote_control.sh (made changes to my local language etc) and i also downloaded and ran the Alexa-Cookie retrieval and got the output, pasted that into the alexa_remote_control.sh file, seems to work as far as list all devices etc, so thats all good, but still nothing like, textcommand, speak, get current volume etc. i do however get a http/200 where as before it was a http/401 but still not working, i dont know what has happened as ive changed nothing on my amazon/alexa account nor made any changed to my stuff at home. so at a loss as to why the commands no longer work :(

adn77 commented

At least you won't have to copy+paste your .alexa.cookie anymore once we get it working :)

Are you able to login to https://alexa.amazon.co.uk/ in your browser? Could you please verify in the developer console that API calls actually use alexa.amazon.co.uk/api/...

Strange thing is that your devices get loaded from /api/devices-v2/device alright.

Either we're using a wrong endpoint or the syntax is wrong.

What do you get when you run alexa_remote_control.sh -q ?

Hi

i can login to https://alexa.amazon.co.uk/ fine :)

im not sure how to find the bit you are after in the developer console?

output of alexa_remote_control.sh -q is:

setting default device to: Mancave
queue info for dev:Mancave type:A1Z88NGR2BK6A2 serial:XXXXXXXXXXXXXXXXX (i masked serial)
{
"playerInfo": {
"hint": null,
"infoText": null,
"isPlayingInLemur": false,
"lemurVolume": null,
"lyrics": null,
"mainArt": null,
"mediaId": null,
"miniArt": null,
"miniInfoText": null,
"playbackSource": null,
"playingInLemurId": null,
"progress": null,
"provider": null,
"quality": null,
"queueId": null,
"state": null,
"template": null,
"transport": null,
"upNextItems": null,
"volume": null
}
}
{
"message": "Device is not connected/initialized"
}
{
"queueInfo": {
"header": null,
"media": null,
"nextPageToken": null,
"previousPageToken": null,
"queueType": null
}
}

i dont understand why it says not connected/initilaised? the device (as all of my alexa) is working fine, when i ask it stuff

Thanks

Well i managaed to get it to work, no idea why this worked tho...

so i changed SET_ALEXA='alexa.amazon.co.uk' to SET_ALEXA='alexa.amazon.com' ran the command alexa_remote_control.sh -q and got "ERROR: no CSRF cookie received"

i changed SET_ALEXA back to SET_ALEXA='alexa.amazon.co.uk' and re ran the command and now it all works???

totally confused, but please it now works

adn77 commented

I am pretty sure you now have a cookie which you didn't receive correctly from amazon.co.uk.
I'd be very interested to know which one it is... if you're willing to give it another try:

  1. delete .alexa.cookie (or copy as backup)
  2. run a command with ALEXA='alexa.amazon.com
  3. post the anonymized output of .alexa.cookie
  4. run a command with ALEXA='alexa.amazon.co.uk'
  5. post the anonymized output of .alexa.cookie

I have a similar issue. Commands like -r and -a are working but not speak:XXX.

I am using the latest alexa_remove_control script and the new recommended authentication method.

adn77 commented

As I wrote in October, this is probably due to some missing cookie.
We'll never find out unless you provide some (anonymized) data :)