cec to turn tv on and off
This commit is contained in:
parent
26c83305f7
commit
f3b4c00691
3 changed files with 28 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/secrets.env
|
||||
/tv_state
|
||||
|
||||
|
|
|
@ -48,6 +48,9 @@ all(){
|
|||
"tasks")
|
||||
;;
|
||||
|
||||
"sleep")
|
||||
sh ~/scripts/PJ/cec.sh
|
||||
;;
|
||||
### test
|
||||
"test")
|
||||
#test code here, run with buttons.sh test
|
||||
|
|
23
cec.sh
Executable file
23
cec.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
tv_on() {
|
||||
cec-ctl --to 0 --image-view-on
|
||||
echo "on">~/scripts/PJ/tv_state
|
||||
}
|
||||
|
||||
tv_off() {
|
||||
cec-ctl --to 0 --standby
|
||||
echo "off">~/scripts/PJ/tv_state
|
||||
}
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
if grep -q off ~/scripts/PJ/tv_state; then
|
||||
tv_on
|
||||
elif grep -q on ~/scripts/PJ/tv_state; then
|
||||
tv_off
|
||||
fi
|
||||
elif [[ $1 = "on" ]]; then
|
||||
tv_on
|
||||
elif [[ $1 = "off" ]]; then
|
||||
tv_off
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue