Index: de.wigbels.ruby/hotcoldrain/draw_graphs.sh
===================================================================
--- de.wigbels.ruby/hotcoldrain/draw_graphs.sh	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hotcoldrain/draw_graphs.sh	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -7,4 +7,6 @@
 rrdtool graph web/temperatur_1monat.png --title "Temperaturen im Monatsverlauf" --font TITLE:12 --vertical-label="Â° Celsius" -w 800 -h 500 -s 'now - 1 month' -e 'now' DEF:temps1=weather.rrd:temps1:AVERAGE LINE2:temps1#204a87:"Temperatur unten" DEF:temps2=weather.rrd:temps2:AVERAGE LINE2:temps2#f57900:"Temperatur oben" DEF:tempmins9=weather.rrd:temps9:MIN DEF:tempmaxs9=weather.rrd:temps9:MAX DEF:temps9=weather.rrd:temps9:AVERAGE CDEF:tempranges9=tempmaxs9,tempmins9,- LINE1:tempmins9#4e9a06 AREA:tempranges9#8ae234::STACK LINE1:tempmaxs9#4e9a06 LINE2:temps9#4e9a06:"Temperatur aussen\n"
 
+rrdtool graph web/temperatur_1jahr.png --title "Temperaturen im Jahresverlauf" --font TITLE:12 --vertical-label="Â° Celsius" -w 800 -h 500 -s 'now - 1 year' -e 'now' DEF:temps1=weather.rrd:temps1:AVERAGE LINE2:temps1#204a87:"Temperatur unten" DEF:temps2=weather.rrd:temps2:AVERAGE LINE2:temps2#f57900:"Temperatur oben" DEF:tempmins9=weather.rrd:temps9:MIN DEF:tempmaxs9=weather.rrd:temps9:MAX DEF:temps9=weather.rrd:temps9:AVERAGE CDEF:tempranges9=tempmaxs9,tempmins9,- LINE1:tempmins9#4e9a06 AREA:tempranges9#8ae234::STACK LINE1:tempmaxs9#4e9a06 LINE2:temps9#4e9a06:"Temperatur aussen\n"
+
 
 rrdtool graph web/luftfeuchtigkeit_1tag.png --title "Luftfeuchtigkeit im Tagesverlauf" --font TITLE:12 --vertical-label="%" -w 800 -h 500 -s 'now - 1 day' -e 'now' DEF:hums1=weather.rrd:hums1:AVERAGE LINE2:hums1#204a87:"Luftfeuchtigkeit unten"  DEF:hums2=weather.rrd:hums2:AVERAGE LINE2:hums2#f57900:"Luftfeuchtigkeit oben" DEF:hums9=weather.rrd:hums9:AVERAGE LINE2:hums9#4e9a06:"Luftfeuchtigkeit aussen\n" GPRINT:hums1:LAST:"Letzte Messung unten\: %3.2lf" GPRINT:hums2:LAST:"oben\: %3.2lf" GPRINT:hums9:LAST:"aussen\: %3.2lf"
@@ -13,4 +15,6 @@
 
 rrdtool graph web/luftfeuchtigkeit_1monat.png --title "Luftfeuchtigkeit im Monatsverlauf" --font TITLE:12 --vertical-label="%" -w 800 -h 500 -s 'now - 1 month' -e 'now' DEF:hums1=weather.rrd:hums1:AVERAGE LINE2:hums1#204a87:"Luftfeuchtigkeit unten"  DEF:hums2=weather.rrd:hums2:AVERAGE LINE2:hums2#f57900:"Luftfeuchtigkeit oben" DEF:hums9=weather.rrd:hums9:AVERAGE LINE2:hums9#4e9a06:"Luftfeuchtigkeit aussen\n"
+
+rrdtool graph web/luftfeuchtigkeit_1jahr.png --title "Luftfeuchtigkeit im Jahresverlauf" --font TITLE:12 --vertical-label="%" -w 800 -h 500 -s 'now - 1 year' -e 'now' DEF:hums1=weather.rrd:hums1:AVERAGE LINE2:hums1#204a87:"Luftfeuchtigkeit unten"  DEF:hums2=weather.rrd:hums2:AVERAGE LINE2:hums2#f57900:"Luftfeuchtigkeit oben" DEF:hums9=weather.rrd:hums9:AVERAGE LINE2:hums9#4e9a06:"Luftfeuchtigkeit aussen\n"
 
 
@@ -51,4 +55,15 @@
 LINE2:rainpd#729fcf
 
+rrdtool graph web/regen_1jahr.png \
+--title "Regen im Jahresverlauf" \
+--font TITLE:12 -w 800 -h 500 \
+-s 'now - 1 year' -e 'now' \
+-v mm/Tag \
+DEF:rains9=weather.rrd:rains9:AVERAGE \
+CDEF:rainpd=rains9,3600,*,24,*,0.295,* \
+CDEF:rainpm=rainpd,30,* \
+VDEF:totalrain=rainpm,AVERAGE \
+GPRINT:totalrain:"Total %6.0lf mm/Jahr" \
+LINE2:rainpd#729fcf
 
 rrdtool graph web/wind_1tag.png --title "Wind im Tagesverlauf" --font TITLE:12 -w 800 -h 500 -s 'now - 1 day' -e 'now' -v km/h DEF:winds9=weather.rrd:winds9:AVERAGE LINE2:winds9#2e3436:"Wind km/h"
@@ -57,2 +72,4 @@
 
 rrdtool graph web/wind_1monat.png --title "Wind im Monatsverlauf" --font TITLE:12 -w 800 -h 500 -s 'now - 1 month' -e 'now' -v km/h DEF:winds9=weather.rrd:winds9:AVERAGE LINE2:winds9#2e3436:"Wind km/h"
+
+rrdtool graph web/wind_1jahr.png --title "Wind im Jahresverlauf" --font TITLE:12 -w 800 -h 500 -s 'now - 1 year' -e 'now' -v km/h DEF:winds9=weather.rrd:winds9:AVERAGE LINE2:winds9#2e3436:"Wind km/h"
Index: de.wigbels.ruby/hotcoldrain/hotcoldrain.rb
===================================================================
--- de.wigbels.ruby/hotcoldrain/hotcoldrain.rb	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hotcoldrain/hotcoldrain.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -65,8 +65,7 @@
         system("rrdtool update #{mypath}/weather.rrd #{rrddata}")
 
-        MQTT::Client.connect('mqtt://notwist:pixies@wigbels.net') do |c|
-          c.publish('oben/temperatur', datagrams[0])
-        end
-        #log(INFO, 'added 100 liter of gas to sensor-database')
+        # MQTT::Client.connect('mqtt://notwist:pixies@wigbels.net') do |c|
+        #   c.publish('oben/temperatur', datagrams[0])
+        # end
       end
       @serialport.close
Index: de.wigbels.ruby/hotcoldrain/web/index.html
===================================================================
--- de.wigbels.ruby/hotcoldrain/web/index.html	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hotcoldrain/web/index.html	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -7,4 +7,5 @@
 <img src="temperatur_1woche.png"> <img src="luftfeuchtigkeit_1woche.png"> <br />
 <img src="temperatur_1monat.png"> <img src="luftfeuchtigkeit_1monat.png"> <br />
+<img src="temperatur_1jahr.png"> <img src="luftfeuchtigkeit_1jahr.png"> <br />
 
 <h2>Regen / Wind</h2>
@@ -12,4 +13,5 @@
 <img src="regen_1woche.png"> <img src="wind_1woche.png"> <br />
 <img src="regen_1monat.png"> <img src="wind_1monat.png"> <br />
+<img src="regen_1jahr.png"> <img src="wind_1jahr.png"> <br />
 
 <p>Stationskoordinaten: 53&deg;34'17.1"N 9&deg;29'21.8"E, Stade-Ottenbeck</p>
Index: de.wigbels.ruby/hothotread/archiv/hothotread.rb
===================================================================
--- de.wigbels.ruby/hothotread/archiv/hothotread.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
+++ de.wigbels.ruby/hothotread/archiv/hothotread.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -0,0 +1,79 @@
+#!/usr/bin/env ruby
+#
+# Author: Norbert Wigbels - foobla.wigbels.de/uber-foobla
+#
+# HotHotRead continously reads the status of a
+# reed contact attached to the avr-net-io
+#
+# The reed measures gas usage.
+#
+# A magig URL is formed and called; the url
+# stores the sensor-data to wigbels.net
+#
+# todo: status-led
+# 
+
+#------------------------------------------
+# Tainted mode 0-4
+$SAFE=0
+
+
+#------------------------------------------
+require 'logger'
+require 'socket'
+require 'net/http'
+
+#------------------------------------------
+class HotHotRead < Logger::Application
+  attr_accessor :socket, :socketaddr
+
+  def initialize(application_name)
+    super(application_name)
+    @socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
+    @sockaddr = Socket.sockaddr_in(2701, '192.168.14.42')
+  end
+
+  def run
+    begin
+      @socket.connect(@sockaddr)
+      high2low = false;
+      while true do
+        @socket.print "io get pin 0\r\n"
+        rawdata = @socket.recvfrom(128)
+        # data contains "port 0: 0xfe"; extract last part
+        data = rawdata.to_s.split(" ")[2]
+        # we are only interested in the changes from high to low of the reed sensor
+        if (data=="0xff")
+          high2low = true
+        else
+          if (high2low==true)
+            high2low = false
+            Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10'))
+            # fixme: response.body auswerten
+            # bei fehler, lokales backlog schreibe 
+            log(INFO, 'added 100 liter of gas to sensor-database')
+          end
+        end
+        sleep(0.2)
+      end
+      # and terminate the connection when we're done
+    rescue => msg
+      log(ERROR, "error: #{msg}")
+      retry
+    ensure
+      @socket.close
+    end
+    #puts "Filename: "+__FILE__.to_s
+    #puts "Linenumber: "+__LINE__.to_s
+    #log(WARN, 'warning',  'mymethod' )
+    #@log.error('my_method2') { 'Error!' }
+  end
+end
+
+
+#------------------------------------------
+status = HotHotRead.new("HotHotRead").start
+
+#if status != 0
+#  puts "Some error occured."
+#end
Index: de.wigbels.ruby/hothotread/archiv/sockconnect.rb
===================================================================
--- de.wigbels.ruby/hothotread/archiv/sockconnect.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
+++ de.wigbels.ruby/hothotread/archiv/sockconnect.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -0,0 +1,16 @@
+require 'socket'
+
+s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
+sockaddr = Socket.sockaddr_in(2701, '192.168.14.42')
+begin
+s.connect(sockaddr)
+rescue
+    puts "error: #{$!}"
+else
+    s.print "version\r\n"
+    data = s.recvfrom(1024)
+    puts data
+    # and terminate the connection when we're done
+    s.close
+end
+
Index: de.wigbels.ruby/hothotread/bla.rb
===================================================================
--- de.wigbels.ruby/hothotread/bla.rb	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ 	(revision )
@@ -1,16 +1,0 @@
-require 'socket'
-
-s = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
-sockaddr = Socket.sockaddr_in(2701, '192.168.14.42')
-begin
-s.connect(sockaddr)
-rescue
-    puts "error: #{$!}"
-else
-    s.print "version\r\n"
-    data = s.recvfrom(1024)
-    puts data
-    # and terminate the connection when we're done
-    s.close
-end
-
Index: de.wigbels.ruby/hothotread/draw_graphs.sh
===================================================================
--- de.wigbels.ruby/hothotread/draw_graphs.sh	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hothotread/draw_graphs.sh	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -11,5 +11,5 @@
 CDEF:gash=gas,120,* \
 VDEF:gastotal=gas,TOTAL \
-GPRINT:gastotal:"Total %6.0lf m3 Gas" \
+GPRINT:gastotal:"Total %6.0lf Liter Gas" \
 LINE2:gash#c17d11:"Gasverbrauch"
 
@@ -22,5 +22,5 @@
 CDEF:gasd=gas,2880,* \
 VDEF:gastotal=gas,TOTAL \
-GPRINT:gastotal:"Total %6.0lf m3 Gas" \
+GPRINT:gastotal:"Total %6.0lf Liter Gas" \
 LINE2:gasd#c17d11:"Gasverbrauch/Tag"
 
@@ -33,5 +33,25 @@
 CDEF:gasd=gas,2880,* \
 VDEF:gastotal=gas,TOTAL \
-GPRINT:gastotal:"Total %6.0lf m3 Gas" \
+GPRINT:gastotal:"Total %6.0lf Liter Gas" \
 LINE2:gasd#c17d11:"Gasverbrauch/Tag"
 
+rrdtool graph web/gas_1jahr.png \
+-w 800 -h 500 \
+-s 'now - 1 year' -e 'now' \
+--title "Gasverbrauch im Jahresverlauf" \
+--font TITLE:12 --vertical-label="Liter/Tag" \
+DEF:gas=gas.rrd:gas:AVERAGE \
+CDEF:gasd=gas,2880,* \
+VDEF:gastotal=gas,TOTAL \
+GPRINT:gastotal:"Total %6.0lf Liter Gas" \
+LINE2:gasd#c17d11:"Gasverbrauch/Tag"
+
+
+
+rrdtool graph web/consum_1day.png   -s 'now -1 day' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
+rrdtool graph web/consum_1week.png   -s 'now -1 week' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
+rrdtool graph web/consum_1month.png   -s 'now -1 month' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
+rrdtool graph web/consum_1year.png   -s 'now -1 year' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
+
+rrdtool graph web/counter_1week.png   -s 'now -1 week' -e 'now'   -X 0 -Y -A   DEF:counter=power.rrd:counter:LAST   LINE2:counter#000000:"ZÃ€hlerstand [kWh]"
+rrdtool graph web/counter_1month.png   -s 'now -1 month' -e 'now'   -X 0 -Y -A   DEF:counter=power.rrd:counter:LAST   LINE2:counter#000000:"ZÃ€hlerstand [kWh]"
Index: de.wigbels.ruby/hothotread/hothotpiper.rb
===================================================================
--- de.wigbels.ruby/hothotread/hothotpiper.rb	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hothotread/hothotpiper.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -19,7 +19,5 @@
 
 #------------------------------------------
-require 'net/http'
 require 'pi_piper'
-
 include PiPiper
 
@@ -27,9 +25,32 @@
 
 
+def last_rrd_count
+  val = 0.0
+  handle = IO.popen("rrdtool lastupdate #{$mypath}/power.rrd")
+  handle.each_line do |line|
+    m = line.match("^[0-9]*: ([0-9.]*) [0-9.]*")
+    if m
+      val = m[1].to_f
+      break
+    end
+  end
+  return val
+end
+
+
 watch :pin => 4, :trigger => :falling do 
   puts('added 10 liter of gas to sensor-database')
-  Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10'))
   system("rrdtool update #{$mypath}/gas.rrd N:10")
 end
 
+watch :pin => 11, :trigger => :falling  do
+  puts('updated power consumption')
+  $counter = $counter + $trigger_step
+  trigger_update = $trigger_step * 3600000.0
+  system("rrdtool update #{$mypath}/power.rrd N:#{$counter}:#{trigger_update}")
+end
+
+$trigger_step = 1.0 / 96
+$counter = last_rrd_count
+
 PiPiper.wait
Index: de.wigbels.ruby/hothotread/hothotread.rb
===================================================================
--- de.wigbels.ruby/hothotread/hothotread.rb	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ 	(revision )
@@ -1,79 +1,0 @@
-#!/usr/bin/env ruby
-#
-# Author: Norbert Wigbels - foobla.wigbels.de/uber-foobla
-#
-# HotHotRead continously reads the status of a
-# reed contact attached to the avr-net-io
-#
-# The reed measures gas usage.
-#
-# A magig URL is formed and called; the url
-# stores the sensor-data to wigbels.net
-#
-# todo: status-led
-# 
-
-#------------------------------------------
-# Tainted mode 0-4
-$SAFE=0
-
-
-#------------------------------------------
-require 'logger'
-require 'socket'
-require 'net/http'
-
-#------------------------------------------
-class HotHotRead < Logger::Application
-  attr_accessor :socket, :socketaddr
-
-  def initialize(application_name)
-    super(application_name)
-    @socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
-    @sockaddr = Socket.sockaddr_in(2701, '192.168.14.42')
-  end
-
-  def run
-    begin
-      @socket.connect(@sockaddr)
-      high2low = false;
-      while true do
-        @socket.print "io get pin 0\r\n"
-        rawdata = @socket.recvfrom(128)
-        # data contains "port 0: 0xfe"; extract last part
-        data = rawdata.to_s.split(" ")[2]
-        # we are only interested in the changes from high to low of the reed sensor
-        if (data=="0xff")
-          high2low = true
-        else
-          if (high2low==true)
-            high2low = false
-            Net::HTTP.get(URI.parse('http://www.wigbels.net/cgi-bin/hhw.rb?sensorid=1&data=10'))
-            # fixme: response.body auswerten
-            # bei fehler, lokales backlog schreibe 
-            log(INFO, 'added 100 liter of gas to sensor-database')
-          end
-        end
-        sleep(0.2)
-      end
-      # and terminate the connection when we're done
-    rescue => msg
-      log(ERROR, "error: #{msg}")
-      retry
-    ensure
-      @socket.close
-    end
-    #puts "Filename: "+__FILE__.to_s
-    #puts "Linenumber: "+__LINE__.to_s
-    #log(WARN, 'warning',  'mymethod' )
-    #@log.error('my_method2') { 'Error!' }
-  end
-end
-
-
-#------------------------------------------
-status = HotHotRead.new("HotHotRead").start
-
-#if status != 0
-#  puts "Some error occured."
-#end
Index: de.wigbels.ruby/hothotread/info/created_rrd_engergy_through
===================================================================
--- de.wigbels.ruby/hothotread/info/created_rrd_engergy_through	(revision c22952c4202a07f37011af02109e36879aa94a21)
+++ de.wigbels.ruby/hothotread/info/created_rrd_engergy_through	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -0,0 +1,10 @@
+rrdtool create power.rrd --step 60 --no-overwrite \
+DS:counter:GAUGE:86400:0:1000000 \
+DS:consum:ABSOLUTE:86400:0:1000000 \
+RRA:LAST:0.5:1:4320 \
+RRA:AVERAGE:0.5:1:4320 \
+RRA:LAST:0.5:1440:30 \
+RRA:AVERAGE:0.5:1440:30 \
+RRA:LAST:0.5:10080:520 \
+RRA:AVERAGE:0.5:10080:520 
+
Index: de.wigbels.ruby/hothotread/lastupdate.rb
===================================================================
--- de.wigbels.ruby/hothotread/lastupdate.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
+++ de.wigbels.ruby/hothotread/lastupdate.rb	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -0,0 +1,14 @@
+def last_rrd_count
+  val = 0.0
+  handle = IO.popen("rrdtool lastupdate power.rrd")
+  handle.each_line do |line|
+    m = line.match("^[0-9]*: ([0-9.]*) [0-9.]*")
+    if m
+      val = m[1].to_f
+      break
+    end
+  end
+  return val
+end
+
+puts last_rrd_count
Index: de.wigbels.ruby/hothotread/web/index.html
===================================================================
--- de.wigbels.ruby/hothotread/web/index.html	(revision 53aed1c15da58c982558a390c0ef178f64c0c16e)
+++ de.wigbels.ruby/hothotread/web/index.html	(revision c22952c4202a07f37011af02109e36879aa94a21)
@@ -7,4 +7,13 @@
 <img src="gas_1woche.png">
 <img src="gas_1monat.png">
+<img src="gas_1jahr.png">
+
+<h2>Strom</h2>
+<img src="consum_1day.png">
+<img src="consum_1week.png">
+<img src="consum_1month.png">
+<img src="consum_1year.png">
+<img src="counter_1month.png">
+<img src="counter_1week.png">
 
 </body>
