thorsten-gehrig / alexa-remote-control

control Amazon Alexa from command Line (set volume, select station from tunein or pandora)
420 stars 103 forks source link

Can't get the script to speak #164

Closed elpekenin closed 1 year ago

elpekenin commented 2 years ago

Hey, I know this is a recurrent question but previous posts I've read didn't fix my issue.

I found this tool when researching how to get my Alexa talking upon certain events, and went ahead to configure it. Idea is to trigger the script from Python/Javascript/wherever neeed.

Note: Only used terminal by hand so far I've used alexa-cookie (not the binary, but running the server myself) to get my REFRESH_TOKEN, and placing it on the script results on a succesfull login (./alexa.sh -a lists both my Echo Show's).

However I've been trying these last 2 days to get the script to talk and couldnt achieve anything, did I perhaps miss some configuration step (likely on the Amazon account/device part of things) or some limitation??

Command seems to output a success

$ ./alexa.sh -e speak:Hola
setting default device to: Echo Show de HIMTAE
sending cmd:speak:Hola to dev:Echo Show de HIMTAE type:A4ZP7ZC4PI6TO serial:XXX customerid:XXX
Korki67 commented 2 years ago

Hello Elpekenin,

please note I am just another user of this great script. Not sure I can help but let's try. As you can login and see your devices, I think all configuration is good and nothing is lacking.

I am always specifying the device with -d and do not rely on any default device. As long as you have a problem, I recommend to use -d devicename to be sure.

Try to let Alexa speak while playing music. Does music stop or reduce volume while the device should speak? Are you sure loudness is high and not zero? I fell into this trap some time ago ... it speaked with volume 0 ... try -z

Sometimes the normal command fails for some time ... no clue why that happens. Must be issues at Amazon. During such time I replace the command (e.g. -r radio) by textcommand "play radio" as workaround. You can also try the workaround -e textcommand:"say Hello". Then the device should also say "Hello".

Option -q gives you a lot of information. Perhaps you glance through it and perhaps you spot something ...

Regards, Horst

Korki67 commented 2 years ago

one more idea: are your two devices connected as a stereo pair? If yes, this may be relevant:

my stereo pairs loose the ability to speak every few days. Also, when I use the Alexa by my normal voice, they don't speak. Unlinking the pair, disconnect & reconnect power, re-link the pair solves this. I don't think it is an issue of the script here but an issue of Amazon.

So in case they are a paired stereo device, unpair, reboot and try again....

and a last one: your device name "de HIMTAE" has a space? I would avoid that for many reasons ...

elpekenin commented 2 years ago

Thanks for all the information :)

I am always specifying the device with -d

  • Tried both with and without it, didn't spot any difference
  • Same results

Try to let Alexa speak while playing music

  • Will try ASAP
  • Can't hear any change

Are you sure loudness is high and not zero?

  • I'm pretty sure I also sent some "change volume" commands yesterday but can't really recall, will re-check
  • -z doesn't output any volume, just the device's info

textcommand as workaround

  • Same as before, pretty sure I tried doing so, but will re-check
  • Nothing either

stereo pair

  • I don't even knew there was such thing, so most likely they arent

has a space?

  • Yeah it does, will try and remove it
  • Changed to Test for now

-q shows the same for both devices, am i missing some config? is this maybe an issue with Spanish? Alexa-Cookie's server and script are configured with amazon.com and en-US except for SET_LANGUAGE and SET_TTS_LOCALE which are set to es-ES

{
  "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
  }
}
Korki67 commented 1 year ago

Hi elpekenin,

yeah the link to amazon.com may be issue. I have a German amazon account, and am linked to amazon.de:

SET_AMAZON='amazon.de'

Did you try to set your relevant line to amazon.es?

Regards, Horst

elpekenin commented 1 year ago

I did try several configs over the days but i dont really remember them anymore.

Ended up using a Home Assistant integration which worked fine for my needs.

Thx for the help anyway, closing this :)