Permalink
Browse files

Added some buffer for PIR sensor, bugfix

  • Loading branch information...
1 parent 7c7ebf2 commit 7d8edf132d42ecd222dc7edc185d945daeb5e336 @igorpecovnik committed Feb 9, 2015
Showing with 10 additions and 3 deletions.
  1. +2 −2 functions.sh
  2. BIN src/rpimonitor-myconfig.tgz
  3. +8 −1 src/temp-pir-daemon.sh
View
@@ -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
}
Binary file not shown.
@@ -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
+Main

0 comments on commit 7d8edf1

Please sign in to comment.