Last active
November 8, 2020 22:32
-
-
Save eldridgea/fea6dcdcf8e53decfdc0404c395bf18c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
soundbar_on_vol_to_5 () { | |
while read -r line | |
do | |
cec-client -d 1 | |
done < /home/pi/on_with_vol_to_5.txt | |
} | |
if [[ $1 = "start" ]] | |
then | |
soundbar_on_vol_to_5 & | |
sleep 15 | |
killall cec-client | |
play /home/pi/output.mp3 > /dev/null 2>&1 & | |
elif [[ $1 = "stop" ]] | |
then | |
killall play | |
echo 'standby 5' | cec-client -s -d 1 | |
elif [[ $1 = "status" ]] | |
then | |
status=$(echo 'pow 5' | cec-client -s -d 1 | grep "power status:") | |
if [[ $status == *standby* ]] | |
then | |
printf "off" | |
elif [[ $status == *on* ]] | |
then | |
printf "on" | |
fi | |
else | |
echo "invalid argument" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment