adapted other scripts to new averageing method

master
Level2 Pidor 2016-01-30 00:41:16 +01:00
parent 4f6ee9d2e2
commit 62f3acb635
3 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,8 @@ p="$(
awk '{print $2}')" awk '{print $2}')"
if [ "$p" != "" ] if [ "$p" != "" ]
then then
echo "$p" > /run/presency :
# echo "$p" > /run/presency # handled now in realtime code
else else
logger $0 cannot access people counter. fallback to dhcp value guessing logger $0 cannot access people counter. fallback to dhcp value guessing
fi fi

View File

@ -9,7 +9,7 @@ else
DEV="" DEV=""
fi fi
STATSFILE="/run/peoplecounter$DEV" STATSFILE="/run/peoplecounter$DEV"
SAMPLES=12 # how many records to keep in file SAMPLES=20 # how many records to keep in file
INTERVAL=10 # how long to wait between polls INTERVAL=10 # how long to wait between polls
MAXFILE="/run/peoplecountermax$DEV" MAXFILE="/run/peoplecountermax$DEV"
PRESENCY="/run/presency$DEV" # value shown on website PRESENCY="/run/presency$DEV" # value shown on website

View File

@ -2,12 +2,12 @@
# this script only makes sense if there is a good people counter installed # this script only makes sense if there is a good people counter installed
if [ "$1" = "closed" ] && [ "$2" = "open" ] if [ "$1" = "closed" ] && [ "$2" = "open" ]
then then
p="$(cat /run/presency)" p="$(tail -1 /run/peoplecounter)"
if [ "$p" != "0" ] if [ "$p" != "0" ]
then then
logger $(basename $0) There are $p people, closed door from inside. Waiting 1 min. logger $(basename $0) There are $p people, closed door from inside. Waiting 1 min.
sleep 60 sleep 60
p="$(cat /run/presency)" p="$(tail -1 /run/peoplecounter)"
if [ "$p" = "0" ] if [ "$p" = "0" ]
then then
logger $(basename $0) There are $p people, after 1 min wait. All OK. logger $(basename $0) There are $p people, after 1 min wait. All OK.