diff --git a/peoplecounter-setup.txt b/peoplecounter-setup.txt new file mode 100644 index 0000000..fb02343 --- /dev/null +++ b/peoplecounter-setup.txt @@ -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 diff --git a/scripts/beamercontrol.sh b/scripts/beamercontrol.sh index 1633df5..415dcd0 100755 --- a/scripts/beamercontrol.sh +++ b/scripts/beamercontrol.sh @@ -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 diff --git a/scripts/beamerdetect.sh b/scripts/beamerdetect.sh index b11e39c..c219a7d 100755 --- a/scripts/beamerdetect.sh +++ b/scripts/beamerdetect.sh @@ -26,14 +26,12 @@ then exit fi signalsource="$(wget -qO - 'http://'"$projip"'/tgi/return.tgi?query=info' |awk -F'[<>]' '//{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- diff --git a/scripts/lightcommander b/scripts/lightcommander index bdac4a9..37256bd 100755 --- a/scripts/lightcommander +++ b/scripts/lightcommander @@ -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) diff --git a/scripts/lockbutton.sh.d/01doormessage b/scripts/lockbutton.sh.d/01doormessage index 111914f..ddf9c3b 100755 --- a/scripts/lockbutton.sh.d/01doormessage +++ b/scripts/lockbutton.sh.d/01doormessage @@ -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 ) & diff --git a/scripts/lockbutton.sh.d/lights b/scripts/lockbutton.sh.d/lights index a8db602..38bc4a3 100755 --- a/scripts/lockbutton.sh.d/lights +++ b/scripts/lockbutton.sh.d/lights @@ -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" diff --git a/scripts/opendoor.sh b/scripts/opendoor.sh index 2eb9e2e..4943cbd 100755 --- a/scripts/opendoor.sh +++ b/scripts/opendoor.sh @@ -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 $?" diff --git a/scripts/upd_status.sh b/scripts/upd_status.sh index c665d24..d7a5a87 100755 --- a/scripts/upd_status.sh +++ b/scripts/upd_status.sh @@ -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 diff --git a/scripts/upd_status.sh.d/lights b/scripts/upd_status.sh.d/lights index a8db602..bd2f3a5 100755 --- a/scripts/upd_status.sh.d/lights +++ b/scripts/upd_status.sh.d/lights @@ -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"