Skip to content

Instantly share code, notes, and snippets.

@saerdnaer
Last active January 12, 2020 17:49
Show Gist options
  • Save saerdnaer/fa7ecee3f16007385bcdb66770d33fe3 to your computer and use it in GitHub Desktop.
Save saerdnaer/fa7ecee3f16007385bcdb66770d33fe3 to your computer and use it in GitHub Desktop.
control hdmi display via cec from raspberry pi
#/bin/bash
# see https://www.screenly.io/blog/2017/07/02/how-to-automatically-turn-off-and-on-your-monitor-from-your-raspberry-pi/#cec-client
# and crontab -e (of user "pi") --Andi
case "$1" in
on)
echo 'on 0' | cec-client -s -d 1
;;
off)
echo 'standby 0' | cec-client -s -d 1
;;
status)
echo 'pow 0' | cec-client -s -d 1
;;
*)
echo $"Usage: $0 {on|off|status}"
exit 1
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment