optimize and simplify projector handling

3dprinter has now lights: switch them off when closing
give some voice status if the internet is down. Like enterprise computer ...
always switch the lights on when opening
master
pidor 2018-04-07 01:22:22 +02:00
parent e5aeca63cf
commit 539125f2e5
9 changed files with 70 additions and 15 deletions

18
peoplecounter-setup.txt Normal file
View File

@ -0,0 +1,18 @@
Mounting height 2770 [mm] See operating instructions
Detection area Xmin -850 [mm] See operating instructions
Wall at Xmin Wall Present
Detection area Xmax 1000 [mm] See operating instructions
Wall at Xmax No Wall
Detection area Ymin -600 [mm] See operating instructions
Wall at Ymin No Wall
Detection area Ymax 600 [mm] See operating instructions
Wall at Ymax No Wall
Forward direction +X
Virtual line Curved Line
Line offset -200 [mm] See operating instructions
Door opens Away§
Door width 820 [mm] See operating instructions
Door height 2000 [mm] See operating instructions
Door decentering 0 [mm] See operating instructions
Min person height 1200 [mm] See operating instructions
Device location Inside

View File

@ -47,6 +47,7 @@ function beameron() {
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3101fe0660 #projector on
if [ "$currstatus" = "off" ]
then
lowerscreen &
echo "Waiting for beamer to boot..."
sleep 18
echo "... is now booted"
@ -59,7 +60,7 @@ function dvi() {
if [ "$currstatus" = "02" ] || [ "$currstatus" = "off" ]
then
echo "not switching, already displaying DVI (or off)"
return 1
return 0
else
echo "Switching to dvi"
wget -qO/dev/null http://$projip/tgi/return.tgi?command=2a3109f6070566 #switch to DVI

View File

@ -26,14 +26,12 @@ then
exit
fi
signalsource="$(wget -qO - 'http://'"$projip"'/tgi/return.tgi?query=info' |awk -F'[<>]' '/<info>/{print substr($3,33,2)}')"
#if [ "$signalsource" = "00" ] || [ "$signalsource" = "15" ] || [ "$signalsource" = "" ]
if [ "$signalsource" = "00" ] ||
[ "$signalsource" = "02" ] ||
[ "$signalsource" = "" ] ||
[ "$signalsource" = "15" ] # always switch off if on chromecast
# ( [ "$signalsource" = "15" ] &&
# [ "$(cat /var/run/caststatus)" = "Backdrop" ] )
then # port 15 is hdmi1 (chromecast)
# if [ "$signalsource" = "00" ] ||
# [ "$signalsource" = "02" ] ||
# [ "$signalsource" = "" ] ||
# [ "$signalsource" = "15" ] # always switch off if on chromecast # port 15 is hdmi1 (chromecast)
if true # no more detecting if door closed by error. Nobody ever did that. Causes just issues
then
raisescreen
lightcommander projector dvioff # swith to slideshow and off
lightcommander projector vol-

View File

@ -8,6 +8,9 @@ then
# echo "usage: $0 {maindoor} {open}"
exit 1
fi
# v---- group A=1, B=2, G=7
# v---- number
# /root/pidor/rcswitch-pi/send 2 7 3 1 <-- 0=off 1=on
function dolight() {
if [ "$2" = "on" ]
then
@ -19,6 +22,7 @@ function dolight() {
all) dolight "main" $2
dolight "status" $2
dolight "labsocket" $2
dolight "3dprinter" $2
dolight "alarm" $2
;;
main) sudo /root/pidor/rcswitch-pi/send 2 1A 1 "$setvalue"
@ -37,6 +41,8 @@ function dolight() {
sleep 1
sudo /root/pidor/rcswitch-pi/send 2 15A 1 "$setvalue" ) &
;;
3dprinter) sudo /root/pidor/rcswitch-pi/send 2 7 3 "$setvalue"
;;
screen) sudo /root/pidor/scripts/beamercontrol.sh screen "$2"
;;
projector) sudo /root/pidor/scripts/beamercontrol.sh beamer "$2"
@ -47,7 +53,7 @@ function dolight() {
;;
stealth) sudo /root/pidor/scripts/stealth.sh
;;
# maindoor) sudo /root/pidor/scripts/opendoor.sh
# maindoor) sudo /root/pidor/scripts/opendoor.sh 2>&1 | logger
# ;;
esac
# type (2=10bit)

View File

@ -9,7 +9,7 @@ fi
if [ "$1" = "pushed" ]
then
oldvol="$(amixer get PCM |awk -F'[][]' '/: Playback.*%/{print $2}')"
amixer set PCM 5%
# amixer set PCM 5%
aplay '/root/win/Windows XP Error.wav'
sleep 1
aplay '/root/win/Windows XP Critical Stop.wav'
@ -18,6 +18,6 @@ then
sleep 1
#espeak -s 120 -p 80 "I will tell you when I am finished." 2>/dev/null
aplay '/root/win/Windows XP Logoff Sound.wav'
amixer set PCM "$oldvol"
# amixer set PCM "$oldvol"
fi
) &

View File

@ -24,10 +24,10 @@ then # switch status lights on, in any case
$(dirname "$0")/../lightcommander status on
# /usr/local/bin/433send 2 2A 1 1 #on
fi
if [ "$1" = "released" ] && # the door has been opened
if [ "$1" = "released" ] # && # the door has been opened
# [ "$(cat /run/spacestatus)" = "open" ] && # status is open
# [ "$(stat -c %Y /run/spacestatus)" -gt "$(date --date "50 minutes ago" +%s)" ] && # since less than 5 minutes
( [ "$(date +%s)" -gt $(/root/pidor/scripts/sunset) ] || [ "$(date +%s)" -lt $(/root/pidor/scripts/sunrise) ] )
# ( [ "$(date +%s)" -gt $(/root/pidor/scripts/sunset) ] || [ "$(date +%s)" -lt $(/root/pidor/scripts/sunrise) ] )
then
#( [ "$(date +%H)" -gt 18 ] || [ "$(date +%H)" -lt 8 ] )
logger -t $(basename $0) "switching some lights on"

View File

@ -1,3 +1,4 @@
#!/bin/bash
RELAYURL="$(cat "$(dirname "$0")"/secret.txt)/state.xml?relay1State=2&pulseTime1=5"
wget -O - --timeout=1 --tries=1 $RELAYURL
logger "$0 wget returns $?"

View File

@ -80,4 +80,35 @@ then
presency=0
fi
/usr/bin/curl --max-time 1 --silent --data key="$spaceapikey" --data-urlencode sensors='{"sensors":{"people_now_present":[{"value":'"$presency"'}]}}' https://spaceapi.syn2cat.lu/sensor/set
if [ $? -ne 0 ]
then
if ! ping -c 1 8.8.8.8 >/dev/null
then
if [ -f /run/netdown.txt ]
then
:
else
touch /run/netdown.txt
fi
if [ "$status" = "open" ]
then
a=$(( $(date "+%s") - $(stat -c %Z /run/netdown.txt) )) # difference in seconds
a=$((a/60)) # minutes
if [ "$a" -gt 20 ] # don't talk if the interruption is less than 20 minutes
then
if [ "$a" -lt 60 ] # talk in hours later
then
espeak -s 100 "Network problem: The internet is not reachable since $a minutes."
else
if [ $((a%10)) = 0 ] # only annoy every 10 minutes
then
espeak -s 100 "Network problem: The internet is not reachable since $((a/60)) hours and $((a%60)) minutes."
fi
fi
fi
fi
fi
else
rm -f /run/var/netdown.txt # reset
fi
V

View File

@ -27,7 +27,7 @@ fi
if [ "$1" = "released" ] && # the door has been opened
# [ "$(cat /run/spacestatus)" = "open" ] && # status is open
# [ "$(stat -c %Y /run/spacestatus)" -gt "$(date --date "50 minutes ago" +%s)" ] && # since less than 5 minutes
( [ "$(date +%s)" -gt $(/root/pidor/scripts/sunset) ] || [ "$(date +%s)" -lt $(/root/pidor/scripts/sunrise) ] )
# ( [ "$(date +%s)" -gt $(/root/pidor/scripts/sunset) ] || [ "$(date +%s)" -lt $(/root/pidor/scripts/sunrise) ] )
then
#( [ "$(date +%H)" -gt 18 ] || [ "$(date +%H)" -lt 8 ] )
logger -t $(basename $0) "switching some lights on"