Commit 7d8edf13 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Added some buffer for PIR sensor, bugfix

parent 7c7ebf27
......@@ -91,7 +91,7 @@ debconf-apt-progress -- apt-get -y install rpimonitor
service rpimonitor stop
# add my own configuration which is not default
cd /etc/rpimonitor
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/rpimonitor-myconfig.tgz?raw=true -O - | tar -xz
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/rpimonitor-myconfig.tgz?raw=true -O - | tar -xhz
cd /usr/local/bin
wget https://github.com/igorpecovnik/Debian-micro-home-server/blob/next/src/temp-pir-daemon.sh
chmod +x /usr/local/bin/temp-pir-daemon.sh
......@@ -100,8 +100,8 @@ cat >> /etc/rc.local <<"EOF"
nohup /usr/local/bin/temp-pir-daemon.sh &
exit 0
EOF
ln -sf /etc/rpimonitor/template/bananian.conf /etc/rpimonitor/data.conf
rm -rf /var/lib/rpimonitor/stat
mkdir -p /var/log/rpimonitor
service rpimonitor start
/usr/share/rpimonitor/scripts/updatePackagesStatus.pl
}
......
......@@ -41,9 +41,16 @@ Main() {
echo -n ${DiskTemp} >/run/hdd-temp
fi
# PIR sensor
if [ ! -f /run/pir-temp ]; then echo 0 > /run/pir-temp; fi
if [ "$(cat /sys/class/gpio/gpio22/value)" == "1" ]; then echo 1 > /run/pir-temp; fi
if [ `stat --format=%Y /run/pir-temp` -le $(( `date +%s` - 600 )) ]; then
cat /sys/class/gpio/gpio22/value > /run/pir-temp
fi
# sleep 5 secs
sleep 5
done
} # Main
Main
\ No newline at end of file
Main
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment