Last change
on this file since b342b88 was
53aed1c,
checked in by Norbert Wigbels <njw@…>, 10 years ago
|
Gaszaehler mit RRDTool-Auswertung
|
-
Property mode set to
100644
|
File size:
797 bytes
|
Rev | Line | |
---|
[0955336] | 1 | #!/usr/bin/env ruby |
---|
| 2 | # |
---|
| 3 | # Author: Norbert Wigbels - foobla.wigbels.de/uber-foobla |
---|
| 4 | # |
---|
| 5 | # HotHotPiper continously reads the status of a |
---|
| 6 | # reed contact attached to the Raspberry Pi GPIO |
---|
| 7 | # |
---|
| 8 | # The reed measures gas usage. |
---|
| 9 | # |
---|
| 10 | # A magig URL is formed and called; the url |
---|
| 11 | # stores the sensor-data to wigbels.net |
---|
| 12 | # |
---|
| 13 | # todo: status-led |
---|
| 14 | # |
---|
| 15 | |
---|
| 16 | #------------------------------------------ |
---|
| 17 | # Tainted mode 0-4 |
---|
| 18 | $SAFE=0 |
---|
| 19 | |
---|
| 20 | #------------------------------------------ |
---|
| 21 | require 'net/http' |
---|
| 22 | require 'pi_piper' |
---|
| 23 | |
---|
| 24 | include PiPiper |
---|
| 25 | |
---|
[53aed1c] | 26 | $mypath = File.expand_path(File.dirname(__FILE__)) |
---|
[daaef3e] | 27 | |
---|
[0955336] | 28 | |
---|
| 29 | watch :pin => 4, :trigger => :falling do |
---|
[4fd0ab9] | 30 | puts('added 10 liter of gas to sensor-database') |
---|
[0955336] | 31 | Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10')) |
---|
[53aed1c] | 32 | system("rrdtool update #{$mypath}/gas.rrd N:10") |
---|
[0955336] | 33 | end |
---|
| 34 | |
---|
| 35 | PiPiper.wait |
---|
Note: See
TracBrowser
for help on using the repository browser.