prepare to show live people counter value
parent
f82755bf20
commit
ed85f9a89f
|
@ -13,7 +13,7 @@ how to install
|
|||
|
||||
sudo vi /etc/xdg/lxsession/LXDE/autostart
|
||||
remove screensaver
|
||||
sudo apt-get install unclutter xdotool git-core screen imagemagick
|
||||
sudo apt-get install unclutter xdotool git-core screen imagemagick x11-xserver-utils
|
||||
git clone git://git.drogon.net/wiringPi
|
||||
cd wiringPi
|
||||
./build
|
||||
|
@ -27,6 +27,7 @@ cat > /home/pi/.config/lxsession/LXDE/autostart <<"EOF"
|
|||
@sudo python ./doorbuzz/setneocolor.py
|
||||
@./doorbuzz/buzzctrl.sh
|
||||
@./doorbuzz/videoplayer.sh
|
||||
@./doorbuzz/arpspoofdetect.sh
|
||||
@sudo python ./doorbuzz/shutdownbutton.py
|
||||
@./doorbuzz/phone_notification_client.sh
|
||||
EOF
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
# led is not neopixel, so use the python lib for that
|
||||
BUTTONPIN=25
|
||||
BUZZERURL="$(cat "$(dirname "$0")"/secret.txt)/state.xml?relay1State=2&pulseTime1=5"
|
||||
BUZZERSTATUSURL="$(cat "$(dirname "$0")"/secret.txt)/state.xml"
|
||||
ATTENUATION=4
|
||||
# file secret.txt should contain username:password
|
||||
cd $(dirname "$0")
|
||||
|
||||
showleds() {
|
||||
./redi.sh <<EOF
|
||||
neoaction=$1
|
||||
neored=$2
|
||||
neogreen=$3
|
||||
neoblue=$4
|
||||
neomorse=$5
|
||||
EOF
|
||||
}
|
||||
pulseon() {
|
||||
red=$1
|
||||
green=$2
|
||||
blue=$3
|
||||
showleds pulse $((red/ATTENUATION)) $((green/ATTENUATION)) $((blue/ATTENUATION)) </dev/null >/dev/null 2>&1 &
|
||||
echo $!
|
||||
}
|
||||
|
||||
echo "Initializing hardware"
|
||||
# the button
|
||||
|
||||
ledcolor() {
|
||||
red=$1
|
||||
green=$2
|
||||
blue=$3
|
||||
showleds set $((red/ATTENUATION)) $((green/ATTENUATION)) $((blue/ATTENUATION))
|
||||
}
|
||||
echo "Main loop"
|
||||
while true
|
||||
do
|
||||
if [ $(arp -a | awk '{arp[$2]=$4;ip[$4]=ip[$4]" "$2}END{print ip[arp["(10.2.113.1)"]]}' | wc -w) -gt 1 ]
|
||||
then
|
||||
ledcolor 255 50 50
|
||||
sleep 1
|
||||
pulseon 255 255 255
|
||||
sleep 60
|
||||
fi
|
||||
done
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
wget -qO - http://10.2.113.6/output.cgi |
|
||||
sed 's/.*Occupancy://'|
|
||||
awk '{print $2}'
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# this gives number of people present via spaceapi
|
||||
# but if network down, this does not work
|
||||
# better get data direct from pidor or peoplecounter
|
||||
import urllib, json
|
||||
url = "https://spaceapi.syn2cat.lu/status/json"
|
||||
response = urllib.urlopen(url);
|
||||
data = json.loads(response.read())
|
||||
print data["sensors"]["people_now_present"][0]["value"]
|
|
@ -7,6 +7,7 @@ fi
|
|||
killall feh
|
||||
trap "killall feh; killall omxplayer" 1 2 3 15
|
||||
feh -F -x black.png &
|
||||
#feh black.png &
|
||||
while true
|
||||
do
|
||||
if [ "$(python ./spacestatus.py)" = "False" ]
|
||||
|
|
Loading…
Reference in New Issue