mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-22 08:49:02 +01:00
PR #109 Added textcommand
Added textcommand which lets you send anything via CLI you would otherwise say to Alexa
This commit is contained in:
commit
3a290675d1
@ -40,7 +40,9 @@ alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|
|
||||
|
||||
-e : run command, additional SEQUENCECMDs:
|
||||
weather,traffic,flashbriefing,goodmorning,singasong,tellstory,
|
||||
speak:'<text/ssml>',automation:'<routine name>,sound:<soundeffect_name>'
|
||||
speak:'<text/ssml>',automation:'<routine name>',sound:<soundeffect_name>,
|
||||
textcommand:'<anything you would otherwise say to Alexa>'
|
||||
|
||||
-b : connect/disconnect/list bluetooth device
|
||||
-q : query queue
|
||||
-n : query notifications
|
||||
|
@ -57,6 +57,8 @@
|
||||
# 2020-06-15: v0.16b added "lastcommand" option
|
||||
# (thanks to Trinitus01 https://github.com/trinitus01)
|
||||
# 2020-07-07: v0.16c fixed NORMALVOL if USE_ANNOUNCEMENT_FOR_SPEAK is set
|
||||
# 2020-12-12: v0.17 added textcommand which lets you send anything via CLI you would otherwise say to Alexa
|
||||
# ( https://github.com/thorsten-gehrig/alexa-remote-control/issues/108 )
|
||||
#
|
||||
###
|
||||
#
|
||||
@ -186,7 +188,8 @@ usage()
|
||||
echo
|
||||
echo " -e : run command, additional SEQUENCECMDs:"
|
||||
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,"
|
||||
echo " speak:'<text/ssml>',automation:'<routine name>',sound:<soundeffect_name>"
|
||||
echo " speak:'<text/ssml>',automation:'<routine name>',sound:<soundeffect_name>,"
|
||||
echo " textcommand:'<anything you would otherwise say to Alexa>'"
|
||||
echo " -b : connect/disconnect/list bluetooth device"
|
||||
echo " -q : query queue"
|
||||
echo " -n : query notifications"
|
||||
@ -213,7 +216,7 @@ usage()
|
||||
while [ "$#" -gt 0 ] ; do
|
||||
case "$1" in
|
||||
--version)
|
||||
echo "v0.16a"
|
||||
echo "v0.17"
|
||||
exit 0
|
||||
;;
|
||||
-d)
|
||||
@ -410,6 +413,11 @@ case "$COMMAND" in
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
textcommand:*)
|
||||
SEQUENCECMD='Alexa.TextCommand\",\"skillId\":\"amzn1.ask.1p.tellalexa'
|
||||
SEQUENCEVAL=$(echo ${COMMAND##textcommand:} | sed -r s/\"/\'/g)
|
||||
SEQUENCEVAL=',\"text\":\"'${SEQUENCEVAL}'\"'
|
||||
;;
|
||||
speak:*)
|
||||
TTS=$(echo ${COMMAND##speak:} | sed -r s/\"/\'/g)
|
||||
if [ $USE_ANNOUNCEMENT_FOR_SPEAK -gt 0 ] ; then
|
||||
@ -650,7 +658,7 @@ if [ -n "${SEQUENCECMD}" ] ; then
|
||||
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
|
||||
else
|
||||
# SequenceCommands are generally not supported on WHA devices
|
||||
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|sound" ; then
|
||||
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|sound|textcommand" ; then
|
||||
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
||||
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
||||
return
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Amazon Alexa Remote Control (PLAIN shell)
|
||||
# alex(at)loetzimmer.de
|
||||
#
|
||||
# 2020-07-07: v0.16c (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||
# 2020-12-12: v0.17 (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||
#
|
||||
###
|
||||
#
|
||||
@ -121,7 +121,8 @@ usage()
|
||||
echo
|
||||
echo " -e : run command, additional SEQUENCECMDs:"
|
||||
echo " weather,traffic,flashbriefing,goodmorning,singasong,tellstory,"
|
||||
echo " speak:'<text>'sound:<soundeffect_name>"
|
||||
echo " speak:'<text>',sound:<soundeffect_name>,"
|
||||
echo " textcommand:'<anything you would otherwise say to Alexa>'"
|
||||
echo " -b : connect/disconnect/list bluetooth device"
|
||||
echo " -q : query queue"
|
||||
echo " -n : query notifications"
|
||||
@ -142,7 +143,7 @@ usage()
|
||||
while [ "$#" -gt 0 ] ; do
|
||||
case "$1" in
|
||||
--version)
|
||||
echo "v0.16a"
|
||||
echo "v0.17"
|
||||
exit 0
|
||||
;;
|
||||
-d)
|
||||
@ -321,6 +322,11 @@ case "$COMMAND" in
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
textcommand:*)
|
||||
SEQUENCECMD='Alexa.TextCommand\",\"skillId\":\"amzn1.ask.1p.tellalexa'
|
||||
SEQUENCEVAL=$(echo ${COMMAND##textcommand:} | sed -r s/\"/\'/g)
|
||||
SEQUENCEVAL=',\"text\":\"'${SEQUENCEVAL}'\"'
|
||||
;;
|
||||
speak:*)
|
||||
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
||||
TTS=',\"textToSpeak\":\"'${TTS}'\"'
|
||||
@ -625,7 +631,7 @@ set_var()
|
||||
run_cmd()
|
||||
{
|
||||
if [ -n "${SEQUENCECMD}" ] ; then
|
||||
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak|sound" ; then
|
||||
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak|sound|textcommand" ; then
|
||||
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
||||
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user