Skip to content

Instantly share code, notes, and snippets.

@eldridgea
Last active November 8, 2020 22:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/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