thorsten-gehrig/alexa-remote-control

Error when launchinsript from shell thru ssh

Closed this issue · 2 comments

Hello. As the script doesn't work anymore, I tried to launch it thru command line (not by domoticz). I have this error:

$ sh alexa_remote_control.sh -e speak:'alors, ça marche ?'
: not founde_control.sh: 78: alexa_remote_control.sh:
: not founde_control.sh: 84: alexa_remote_control.sh:
: not founde_control.sh: 87: alexa_remote_control.sh:
: not founde_control.sh: 89: alexa_remote_control.sh:
: not founde_control.sh: 92: alexa_remote_control.sh:
: not founde_control.sh: 95: alexa_remote_control.sh:
: not founde_control.sh: 98: alexa_remote_control.sh:
: not founde_control.sh: 105: alexa_remote_control.sh:
: not founde_control.sh: 109: alexa_remote_control.sh:
: not founde_control.sh: 112: alexa_remote_control.sh:
: not founde_control.sh: 115: alexa_remote_control.sh:
: not founde_control.sh: 120: alexa_remote_control.sh:
: not founde_control.sh: 123: alexa_remote_control.sh:
: not founde_control.sh: 128: alexa_remote_control.sh:
: not founde_control.sh: 132: alexa_remote_control.sh:
: not founde_control.sh: 136: alexa_remote_control.sh:
: not founde_control.sh: 157: alexa_remote_control.sh:
: not founde_control.sh: 160: alexa_remote_control.sh:
: not founde_control.sh: 162: alexa_remote_control.sh:
: not founde_control.sh: 187: alexa_remote_control.sh:
: not founde_control.sh: 189: alexa_remote_control.sh: {
alexa_remote_control.sh [-d |ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|repeat|vol:<0-100>> |
-b [list|<"AA:BB:CC:DD:EE:FF">] | -q | -n | -r <"station name"|stationid> |
-s <trackID|'Artist' 'Album'> | -t | -u | -v | -w |
-i | -p | -P | -S | -a | -m <multiroom_device> [device_1 .. device_X] | -lastalexa | -lastcommand | -z | -l | -h
: not founde_control.sh: 194: alexa_remote_control.sh: echo
-e : run command, additional SEQUENCECMDs:
weather,traffic,flashbriefing,goodmorning,singasong,tellstory,
speak:'<text/ssml>',automation:'',sound:<soundeffect_name>,
textcommand:''
-b : connect/disconnect/list bluetooth device
-q : query queue
-n : query notifications
-r : play tunein radio
-s : play library track/library album
-t : play Prime playlist
-u : play Prime station
-v : play Prime historical queue
-w : play library playlist
-i : list imported library tracks
-p : list purchased library tracks
-P : list Prime playlists
-S : list Prime stations
-a : list available devices
-m : delete multiroom and/or create new multiroom containing devices
-lastalexa : print device that received the last voice command
-lastcommand : print last voice command or last voice command of specific device
-z : print current volume level
-login : Logs in, without further command
-l : logoff
-h : help
: not founde_control.sh: 220: alexa_remote_control.sh: }
: not founde_control.sh: 221: alexa_remote_control.sh:
alexa_remote_control.sh: 223: alexa_remote_control.sh: Syntax error: word unexpected (expecting "in")

Could you help ? System is an ordinary and up to date raspbian running on a Ras pi R3

Bonsoir Philtass,

I am no expert to the Alexa script, just an experienced Unix / Linux user. I see three items for you to look at:

1
You wrote "sh alexa......". That would never work for me. I would need to call "sudo ./alexa....". The "./" refer to the current directory and this is needed as long as the alexa script is not in the PATH. I am not sure all your paths are working propperly. This may cause the : not founde_control.sh: 160: alexa_remote_control.sh:

The first line inside the alexa script is a "pseudo comment" which actually runs the shell. So the "sh" on the command line is not needed. The alexa script needs to be executable: chmod a+x alexa.....

In my case, I let user www-data run the script. Therefore, I test it with "sudo -u www-data ./alexa......". Otherwise, cookies and temp files get messed up regardind access rights. You should not run the script with changing users. It should always be the same user running the script.

2
You just give -e option without a -d device. This may also be an issue. You can list your devices with "-a" option to the script. Lets assume you have "cuisin". Then you run "./alexa.... -d cuisine -e speak:'ca marche!'

For purpose of testing, you should not use french specials like "ç". Once you got the c working, after you can try a ç or é ;-)

3
I am not sure about your source. Simpliest way is to get it via git and clone:

$ git clone https://github.com/thorsten-gehrig/alexa-remote-control.git

If you don't have "git", you need to install it:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git

This gives a file that is perfectly up to date and executable in the good way.

Conclusion:
For me, the script is fully running including -e speak. I currently only have issues with turning on radio with -r.

I hope some of my hints help.

Regards,
Horst