Last change
on this file since daaef3e was daaef3e, checked in by njw <njw@…>, 10 years ago |
Daemonized monitoring scripts
|
-
Property mode
set to
100644
|
File size:
804 bytes
|
Line | |
---|
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 |
|
---|
26 | @mypath = File.expand_path(File.dirname(__FILE__))
|
---|
27 |
|
---|
28 |
|
---|
29 | watch :pin => 4, :trigger => :falling do
|
---|
30 | puts('added 10 liter of gas to sensor-database')
|
---|
31 | Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10'))
|
---|
32 | system("rrdtool update #{@mypath}/energy.rrd N:10:U:U")
|
---|
33 | end
|
---|
34 |
|
---|
35 | PiPiper.wait
|
---|
Note:
See
TracBrowser
for help on using the repository browser.