alexa-remote-control/README.md

81 lines
4.1 KiB
Markdown
Raw Normal View History

2017-12-08 10:23:10 +01:00
# alexa-remote-control
control Amazon Alexa from command Line
2019-01-23 11:56:54 +01:00
The settings can now be controlled via environment variables.
```
EMAIL - your login email
PASSWORD - your login password
BROWSER - the User-Agent your browser sends in the request header
LANGUAGE - the Accept-Language your browser sends in the request header
AMAZON - your Amazon domain
ALEXA - the URL you would use for the Alexa Web App
CURL - location of your cURL binary
OPTS - any cURL options you require
TMP - location of the temp dir
2019-07-08 21:12:09 +02:00
OATHTOOL - command line for oathtool MFA
2019-08-05 21:33:45 +02:00
MFA_SECRET- the MFA secret
2020-02-03 22:04:04 +01:00
SPEAKVOL - the volume for speak messages ( if set to 0, volume levels are left untouched)
2020-01-03 23:49:27 +01:00
NORMALVOL - if no current playing volume can be determined, fall back to normal volume
VOLMAXAGE - max. age in minutes before volume is re-read from API
DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
DEVICEVOLSPEAK - a list of speak volume levels - matching the devices above
DEVICEVOLNORMAL - a list of normal volume levels- matching the devices above
2020-07-07 23:32:47 +02:00
(current playing volume takes precedence for normal volume)
2020-02-09 20:53:03 +01:00
USE_ANNOUNCEMENT_FOR_SPEAK - Announcements can be made to multiple devices, while
2020-07-07 23:32:47 +02:00
regular SPEAK cannot but the announcement feature has
to be turned on for those devices. Also supports SSML!
2019-01-23 11:56:54 +01:00
```
You will very likely want to set the language to:
```
export LANGUAGE='de,en-US;q=0.7,en;q=0.3'
```
2017-12-08 10:25:30 +01:00
```
2019-01-23 00:08:29 +01:00
alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|repeat|vol:<0-100>> |
2019-08-25 17:20:59 +02:00
-b [list|<"AA:BB:CC:DD:EE:FF">] | -q | -n | -r <"station name"|stationid> |
2018-06-18 17:48:47 +02:00
-s <trackID|'Artist' 'Album'> | -t <ASIN> | -u <seedID> | -v <queueID> |
2020-01-03 23:49:27 +01:00
-w <playlistId> | -i | -p | -P | -S | -a | -z | -l | -h |
-m <multiroom_device> [device_1 .. device_X] | -lastalexa | -lastcommand
2018-06-18 17:48:47 +02:00
-e : run command, additional SEQUENCECMDs:
2018-06-18 20:26:09 +02:00
weather,traffic,flashbriefing,goodmorning,singasong,tellstory,
2020-02-09 20:53:03 +01:00
speak:'<text/ssml>',automation:'<routine name>,sound:<soundeffect_name>'
2018-01-10 08:25:35 +01:00
-b : connect/disconnect/list bluetooth device
2018-06-18 17:48:47 +02:00
-q : query queue
2019-08-25 17:20:59 +02:00
-n : query notifications
2017-12-08 10:23:10 +01:00
-r : play tunein radio
2018-06-18 17:48:47 +02:00
-s : play library track/library album
2017-12-08 10:23:10 +01:00
-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
2018-03-01 22:37:14 +01:00
-lastalexa : print device that received the last voice command
-lastcommand : print last voice command or last voice command of specific device
2020-02-03 22:04:04 +01:00
-login : Logs in, without further command (downloads cookie)
2020-01-03 23:49:27 +01:00
-z : print current volume level
2017-12-08 10:23:10 +01:00
-l : logoff
-h : help
2017-12-08 10:25:30 +01:00
```
2017-12-08 10:23:10 +01:00
2020-01-03 23:49:27 +01:00
There's also a "plain" version, which lacks some functionality (-z, -i, -p, -P, -S and no radio station names and no routines) but doesn't require 'jq' for JSON processing.
2017-12-08 10:23:10 +01:00
2019-07-08 23:33:52 +02:00
In order to use MFA, one needs to obtain the MFA_SECRET from Amazon account:
2019-07-08 23:25:41 +02:00
1. You should have MFA using an App already working before proceeding
1. Add a new app
1. When presented with the QR-code select "can't scan code"
2019-07-08 23:33:52 +02:00
1. You will be presented with the MFA shared secret, something like `1234 5678 9ABC DEFG HIJK LMNO PQRS TUVW XYZ0 1234 5678 9ABC DEFG`
1. Now you have to generate a valid response code via `oathtool -b --totp "<MFA shared secret from above>"` and enter that in the web form
1. Going from here the MFA shared secret becomes the MFA_SECRET for the alexa_remote_control script
*Treat that MFA_SCECRET just like your password - DO NOT share it anywhere!!!*
It is assumed that MFA secured accounts are less likely to get a captcha response during login - that's why MFA might yield better results if the plain username/password didn't work for you.
2019-07-08 23:25:41 +02:00
2017-12-08 10:23:10 +01:00
http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html