mirror of
https://github.com/thorsten-gehrig/alexa-remote-control.git
synced 2024-11-22 08:49:02 +01:00
write volume to volume cache when volume is changed
This commit is contained in:
parent
c52abdcc23
commit
67610c7b28
@ -77,6 +77,7 @@
|
|||||||
# 2021-11-16: v0.20c fixed AlexaApp device selection: since they're all called "This Device" use corresponding
|
# 2021-11-16: v0.20c fixed AlexaApp device selection: since they're all called "This Device" use corresponding
|
||||||
# line in /tmp/.alexa.devicelist.txt, e.g.: -d "This Device=A2TF17PFR55MTB=ce0123456789abcdef01=VOX"
|
# line in /tmp/.alexa.devicelist.txt, e.g.: -d "This Device=A2TF17PFR55MTB=ce0123456789abcdef01=VOX"
|
||||||
# -lastalexa now returns this string. Make sure to put the device in double quotes!
|
# -lastalexa now returns this string. Make sure to put the device in double quotes!
|
||||||
|
# 2022-02-04: v0.20d minor volume fix (write volume to volume cache when volume is changed)
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
@ -247,7 +248,7 @@ usage()
|
|||||||
while [ "$#" -gt 0 ] ; do
|
while [ "$#" -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--version)
|
--version)
|
||||||
echo "v0.20c"
|
echo "v0.20d"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
@ -776,9 +777,18 @@ if [ -n "${SEQUENCECMD}" ] ; then
|
|||||||
DEVICETYPE=$(grep "${DEVICESERIALNUMBER}" ${DEVLIST}.txt | cut -d'=' -f 2)
|
DEVICETYPE=$(grep "${DEVICESERIALNUMBER}" ${DEVLIST}.txt | cut -d'=' -f 2)
|
||||||
NODESTOEXECUTE=$(add_node "$(node)" "${NODESTOEXECUTE}")
|
NODESTOEXECUTE=$(add_node "$(node)" "${NODESTOEXECUTE}")
|
||||||
|
|
||||||
|
# if SequenceCommand is "Alexa.DeviceControls.Volume" we have to adjust the local volume cache
|
||||||
|
if [ "$SEQUENCECMD" = "Alexa.DeviceControls.Volume" ] ; then
|
||||||
|
VOL=${SEQUENCEVAL%\\\"}
|
||||||
|
VOL=${VOL##*\\\"}
|
||||||
|
if [ $VOL -gt 0 ] ; then
|
||||||
|
echo $VOL false > "${TMP}/.alexa.volume.${DEVICESERIALNUMBER}"
|
||||||
|
else
|
||||||
|
echo 0 true > "${TMP}/.alexa.volume.${DEVICESERIALNUMBER}"
|
||||||
|
fi
|
||||||
# add volume setting per device - the WHA volume is unrelyable
|
# add volume setting per device - the WHA volume is unrelyable
|
||||||
# don't set volume if Alexa.Music.PlaySearchPhrase is used
|
# don't set volume if Alexa.Music.PlaySearchPhrase is used
|
||||||
if [ \( $SPEAKVOL -gt 0 -o -n "${DEVICEVOLSPEAK}" \) -a "${SEQUENCECMD}" != "Alexa.Music.PlaySearchPhrase" ] ; then
|
elif [ \( $SPEAKVOL -gt 0 -o -n "${DEVICEVOLSPEAK}" \) -a "${SEQUENCECMD}" != "Alexa.Music.PlaySearchPhrase" ] ; then
|
||||||
DEVICE=$(grep "${DEVICESERIALNUMBER}" ${DEVLIST}.txt | cut -d'=' -f 1)
|
DEVICE=$(grep "${DEVICESERIALNUMBER}" ${DEVLIST}.txt | cut -d'=' -f 1)
|
||||||
get_volumes
|
get_volumes
|
||||||
VOLUMEPRENODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${SVOL}'\"') ${VOLUMEPRENODESTOEXECUTE})
|
VOLUMEPRENODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${SVOL}'\"') ${VOLUMEPRENODESTOEXECUTE})
|
||||||
@ -793,8 +803,16 @@ if [ -n "${SEQUENCECMD}" ] ; then
|
|||||||
else
|
else
|
||||||
NODESTOEXECUTE=$(add_node "$(node)" "${NODESTOEXECUTE}")
|
NODESTOEXECUTE=$(add_node "$(node)" "${NODESTOEXECUTE}")
|
||||||
|
|
||||||
|
if [ "$SEQUENCECMD" = "Alexa.DeviceControls.Volume" ] ; then
|
||||||
|
VOL=${SEQUENCEVAL%\\\"}
|
||||||
|
VOL=${VOL##*\\\"}
|
||||||
|
if [ $VOL -gt 0 ] ; then
|
||||||
|
echo $VOL false > "${TMP}/.alexa.volume.${DEVICESERIALNUMBER}"
|
||||||
|
else
|
||||||
|
echo 0 true > "${TMP}/.alexa.volume.${DEVICESERIALNUMBER}"
|
||||||
|
fi
|
||||||
# don't set volume if Alexa.Music.PlaySearchPhrase is used
|
# don't set volume if Alexa.Music.PlaySearchPhrase is used
|
||||||
if [ \( $SPEAKVOL -gt 0 -o -n "${DEVICEVOLSPEAK}" \) -a "${SEQUENCECMD}" != "Alexa.Music.PlaySearchPhrase" ] ; then
|
elif [ \( $SPEAKVOL -gt 0 -o -n "${DEVICEVOLSPEAK}" \) -a "${SEQUENCECMD}" != "Alexa.Music.PlaySearchPhrase" ] ; then
|
||||||
get_volumes
|
get_volumes
|
||||||
VOLUMEPRENODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${SVOL}'\"') ${VOLUMEPRENODESTOEXECUTE})
|
VOLUMEPRENODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${SVOL}'\"') ${VOLUMEPRENODESTOEXECUTE})
|
||||||
VOLUMEPOSTNODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${VOL}'\"') ${VOLUMEPOSTNODESTOEXECUTE})
|
VOLUMEPOSTNODESTOEXECUTE=$(add_node $(node Alexa.DeviceControls.Volume ',\"value\":\"'${VOL}'\"') ${VOLUMEPOSTNODESTOEXECUTE})
|
||||||
|
Loading…
Reference in New Issue
Block a user