automatically lower projection screen when projector is switched on

when space is closed, switch off projector and raise screen
master
Level2 Pidor 2015-07-22 00:48:43 +02:00
parent 9e41065af5
commit ddd7df81a1
2 changed files with 11 additions and 1 deletions

View File

@ -1,4 +1,11 @@
#!/bin/bash #!/bin/bash
if [ "$1" = "off" ]
then
projip=$(arp -an|awk -F'[()]' '/00:50:41:79:d1:34/{print $2}')
ssh pi@doorbuzz 'doorbuzz/projectionscreen.sh up'
wget -qO - 'http://'"$projip"'/tgi/return.tgi?command=2a3102fd0660'
exit
fi
prevstatus="unknown" prevstatus="unknown"
while true while true
do do
@ -6,12 +13,13 @@ do
# from the acer webpage we read that bytes 30-31 contain 00 if poer off and 01 if power on # from the acer webpage we read that bytes 30-31 contain 00 if poer off and 01 if power on
# we only test if 01, because if off, it can also give no response # we only test if 01, because if off, it can also give no response
# but seems to be bytes 32-33 more accurate # but seems to be bytes 32-33 more accurate
statusbyte="$(wget -qO - 'http://10.2.113.104/tgi/return.tgi?query=info'|awk -F'[<>]' '/<info>/{print substr($3,31,2)}')" statusbyte="$(wget -qO - 'http://'"$projip"'/tgi/return.tgi?query=info'|awk -F'[<>]' '/<info>/{print substr($3,31,2)}')"
if [ "$statusbyte" = "01" ] if [ "$statusbyte" = "01" ]
then then
if [ "$prevstatus" != "on" ] if [ "$prevstatus" != "on" ]
then then
logger -t $(basename $0) "$$ Projector is on" logger -t $(basename $0) "$$ Projector is on"
ssh pi@doorbuzz 'doorbuzz/projectionscreen.sh down'
prevstatus="on" prevstatus="on"
fi fi
else else

View File

@ -0,0 +1,2 @@
#!/bin/bash
$(dirname $0)/../beamerdetect.sh off