mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-23 01:09:02 +01:00
SPEAKVOL of 0 leaves the volume setting untouched
This commit is contained in:
commit
9b12ee2811
@ -15,7 +15,7 @@ OPTS - any cURL options you require
|
|||||||
TMP - location of the temp dir
|
TMP - location of the temp dir
|
||||||
OATHTOOL - command line for oathtool MFA
|
OATHTOOL - command line for oathtool MFA
|
||||||
MFA_SECRET- the MFA secret
|
MFA_SECRET- the MFA secret
|
||||||
SPEAKVOL - the volume for speak messages
|
SPEAKVOL - the volume for speak messages ( if set to 0, volume levels are left untouched)
|
||||||
NORMALVOL - if no current playing volume can be determined, fall back to normal volume
|
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
|
VOLMAXAGE - max. age in minutes before volume is re-read from API
|
||||||
DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
|
DEVICEVOLNAME - a list of device names with specific volume settings (space separated)
|
||||||
@ -53,6 +53,7 @@ alexa-remote-control [-d <device>|ALL] -e <pause|play|next|prev|fwd|rwd|shuffle|
|
|||||||
-a : list available devices
|
-a : list available devices
|
||||||
-m : delete multiroom and/or create new multiroom containing devices
|
-m : delete multiroom and/or create new multiroom containing devices
|
||||||
-lastalexa : print device that received the last voice command
|
-lastalexa : print device that received the last voice command
|
||||||
|
-login : Logs in, without further command (downloads cookie)
|
||||||
-z : print current volume level
|
-z : print current volume level
|
||||||
-l : logoff
|
-l : logoff
|
||||||
-h : help
|
-h : help
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
# 2019-12-30: v0.15 re-worked the volume setting for TTS commands
|
# 2019-12-30: v0.15 re-worked the volume setting for TTS commands
|
||||||
# 2020-01-03: v0.15a introduce some proper "get_volume"
|
# 2020-01-03: v0.15a introduce some proper "get_volume"
|
||||||
# 2020-01-08: v0.15b cleaned merge errors
|
# 2020-01-08: v0.15b cleaned merge errors
|
||||||
|
# 2020-02-03: v0.15c SPEAKVOL of 0 leaves the volume setting untouched
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@ -97,7 +98,7 @@ SET_OATHTOOL='/usr/bin/oathtool'
|
|||||||
# tmp path
|
# tmp path
|
||||||
SET_TMP="/tmp"
|
SET_TMP="/tmp"
|
||||||
|
|
||||||
# Volume for speak commands
|
# Volume for speak commands (a SPEAKVOL of 0 leaves the volume settings untouched)
|
||||||
SET_SPEAKVOL="30"
|
SET_SPEAKVOL="30"
|
||||||
# if no current playing volume can be determined, fall back to normal volume
|
# if no current playing volume can be determined, fall back to normal volume
|
||||||
SET_NORMALVOL="10"
|
SET_NORMALVOL="10"
|
||||||
@ -197,7 +198,7 @@ usage()
|
|||||||
while [ "$#" -gt 0 ] ; do
|
while [ "$#" -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--version)
|
--version)
|
||||||
echo "v0.15b"
|
echo "v0.15c"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
@ -392,9 +393,10 @@ case "$COMMAND" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
speak:*)
|
speak:*)
|
||||||
SEQUENCECMD='Alexa.Speak'
|
|
||||||
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
||||||
TTS=',\"textToSpeak\":\"'${TTS}'\"'
|
TTS=',\"textToSpeak\":\"'${TTS}'\"'
|
||||||
|
SEQUENCECMD='Alexa.Speak'
|
||||||
|
SEQUENCEVAL=$TTS
|
||||||
;;
|
;;
|
||||||
automation:*)
|
automation:*)
|
||||||
SEQUENCECMD='automation'
|
SEQUENCECMD='automation'
|
||||||
@ -617,12 +619,14 @@ if [ -n "${SEQUENCECMD}" ] ; then
|
|||||||
|
|
||||||
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
|
ALEXACMD='{"behaviorId":"'${AUTOMATION}'","sequenceJson":"'${SEQUENCE}'","status":"ENABLED"}'
|
||||||
else
|
else
|
||||||
# the speak command is treated differently in that the wolume gets set to $SPEAKVOL
|
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak" ; then
|
||||||
if [ -n "${TTS}" ] ; then
|
|
||||||
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
||||||
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
# the speak command is treated differently if $SPEAKVOL is > 0
|
||||||
|
if [ -n "${TTS}" -a $SPEAKVOL -gt 0 ] ; then
|
||||||
SVOL=$SPEAKVOL
|
SVOL=$SPEAKVOL
|
||||||
|
|
||||||
# Not using arrays here in order to be compatible with non-Bash
|
# Not using arrays here in order to be compatible with non-Bash
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Amazon Alexa Remote Control (PLAIN shell)
|
# Amazon Alexa Remote Control (PLAIN shell)
|
||||||
# alex(at)loetzimmer.de
|
# alex(at)loetzimmer.de
|
||||||
#
|
#
|
||||||
# 2020-01-08: v0.15b (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
# 2020-02-03: v0.15c (for updates see http://blog.loetzimmer.de/2017/10/amazon-alexa-hort-auf-die-shell-echo.html)
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@ -51,7 +51,7 @@ SET_OATHTOOL='/usr/bin/oathtool'
|
|||||||
# tmp path
|
# tmp path
|
||||||
SET_TMP="/tmp"
|
SET_TMP="/tmp"
|
||||||
|
|
||||||
# Volume for speak commands
|
# Volume for speak commands (a SPEAKVOL of 0 leaves the volume settings untouched)
|
||||||
SET_SPEAKVOL="30"
|
SET_SPEAKVOL="30"
|
||||||
# if no current playing volume can be determined, fall back to normal volume
|
# if no current playing volume can be determined, fall back to normal volume
|
||||||
SET_NORMALVOL="10"
|
SET_NORMALVOL="10"
|
||||||
@ -141,7 +141,7 @@ usage()
|
|||||||
while [ "$#" -gt 0 ] ; do
|
while [ "$#" -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--version)
|
--version)
|
||||||
echo "v0.15b"
|
echo "v0.15c"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
@ -321,9 +321,10 @@ case "$COMMAND" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
speak:*)
|
speak:*)
|
||||||
SEQUENCECMD='Alexa.Speak'
|
|
||||||
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
TTS=$(echo ${COMMAND##*:} | sed -r 's/["\\]/ /g')
|
||||||
TTS=",\\\"textToSpeak\\\":\\\"${TTS}\\\""
|
TTS=',\"textToSpeak\":\"'${TTS}'\"'
|
||||||
|
SEQUENCECMD='Alexa.Speak'
|
||||||
|
SEQUENCEVAL=$TTS
|
||||||
;;
|
;;
|
||||||
weather)
|
weather)
|
||||||
SEQUENCECMD='Alexa.Weather.Play'
|
SEQUENCECMD='Alexa.Weather.Play'
|
||||||
@ -619,12 +620,14 @@ set_var()
|
|||||||
run_cmd()
|
run_cmd()
|
||||||
{
|
{
|
||||||
if [ -n "${SEQUENCECMD}" ] ; then
|
if [ -n "${SEQUENCECMD}" ] ; then
|
||||||
# the speak command is treated differently in that the wolume gets set to $SPEAKVOL
|
if echo $COMMAND | grep -q -E "weather|traffic|flashbriefing|goodmorning|singasong|tellstory|speak" ; then
|
||||||
if [ -n "${TTS}" ] ; then
|
|
||||||
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
if [ "${DEVICEFAMILY}" = "WHA" ] ; then
|
||||||
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
echo "Skipping unsupported command: ${COMMAND} on dev:${DEVICE} type:${DEVICETYPE} serial:${DEVICESERIALNUMBER} family:${DEVICEFAMILY}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
# the speak command is treated differently if $SPEAKVOL > 0
|
||||||
|
if [ -n "${TTS}" -a $SPEAKVOL -gt 0 ] ; then
|
||||||
SVOL=$SPEAKVOL
|
SVOL=$SPEAKVOL
|
||||||
|
|
||||||
# Not using arrays here in order to be compatible with non-Bash
|
# Not using arrays here in order to be compatible with non-Bash
|
||||||
|
Loading…
Reference in New Issue
Block a user