Skip to content

Instantly share code, notes, and snippets.

@eldridgea
Last active November 8, 2020 22:32
Show Gist options
  • Save eldridgea/fea6dcdcf8e53decfdc0404c395bf18c to your computer and use it in GitHub Desktop.
Save eldridgea/fea6dcdcf8e53decfdc0404c395bf18c to your computer and use it in GitHub Desktop.
#!/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