AndreasHeger / pi-monitoring

Various small projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The scripts in these directory perform two tasks:

  • monitoring the temperature across the house
  • monitoring power generation from our roof PV system

The scripts are installed onto two raspberry PIs

Solar Monitoring

Inverter: Samil

Installation instructions

The following instructions assume that you are root.

Open a port in the firewall if active. Necessary to communicate with the SAMIL inverter. The inverter communicates by default on ports 1200 and 1300:

vi /etc/sysconfig/iptables

Append rules (before any of the REJECT rules):

-A INPUT -m state --state NEW -m tcp -p tcp --dport 1200 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 1300 -j ACCEPT

Restart:

/etc/init.d/iptables restart

Create memory disk:

mkdir /mnt/ramdisk
chmod 777 /mnt/ramdisk

Add the following to /etc/fstab:

tmpfs           /mnt/ramdisk tmpfs      defaults,size=256M 0 0

Update software:

apt-get install rrdtool python-rrdtool python-daemon

Install daemon script:

mv monitor_solar /etc/init.d/monitor_solar
mkdir /usr/share/solar
mv monitor_solar.py /usr/share/solar/solar_monitor.py
chmod u+x /etc/init.d/monitor_solar
update-rc.d monitor_solar defaults 80

Install web frontend. Install apache, php, etc:

apt-get install ganglia-webfrontend
chmod 775 solarweb.py
mv solarweb.py /usr/lib/cgi-bin/
ln -s /usr/lib/cgi-bin/solarweb.py /home/pi/solarweb.py
chown -R www-data:www-data /usr/lib/cgi-bin/solarweb.py /mnt/ramdisk
ln -s /mnt/ramdisk /var/www/images

Setup backups of rrd directories:

mkdir /var/ramdisk-backup
mv ramdisk_backup.sh /etc/init.d/ramdisk
chmod 755 /etc/init.d/ramdisk
chown root:root /etc/init.d/ramdisk

Activate at start:

update-rc.d ramdisk defaults 00 99

Setup cronjob as root, every 5mins past midnight:

echo "@daily  /etc/init.d/ramdisk sync >> /dev/null 2>&1" | sudo crontab

Temperature monitoring system

Installation:

mv monitor_temperature.sh /etc/init.d/monitor_temperature
chmod 755 /etc/init.d/monitor_temperature
update-rc.d monitor_weather defaults 80
chmod 775 temperatureweb.py
mv temperatureweb.py /usr/lib/cgi-bin/
ln -s /usr/lib/cgi-bin/temperatureweb.py /home/pi/temperatureweb.py
chown -R www-data:www-data /usr/lib/cgi-bin/temperatureweb.py /mnt/ramdisk

Weather monitoring system

Installation:

mv monitor_weather.sh /etc/init.d/monitor_weather
chmod 755 /etc/init.d/monitor_weather
mv monitor_weather.py /usr/share/solar/monitor_weather.py
chmod u+x /etc/init.d/monitor_weather
update-rc.d monitor_weather defaults 80

Changes for devicetree

/boot/config.txt

dtoverlay=w1-gpio dtparam=i2c-arm

About

Various small projects

License:GNU General Public License v2.0


Languages

Language:JavaScript 87.1%Language:Python 6.7%Language:CoffeeScript 1.9%Language:Shell 1.7%Language:CSS 1.2%Language:Ruby 0.7%Language:HTML 0.7%