Changeset c22952c
- Timestamp:
- 12/05/2015 09:53:28 PM (9 years ago)
- Branches:
- master
- Children:
- 8cc14b9
- Parents:
- b342b88
- Location:
- de.wigbels.ruby
- Files:
-
- 2 added
- 21 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
de.wigbels.ruby/hotcoldrain/draw_graphs.sh
rb342b88 rc22952c 7 7 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" 8 8 9 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" 10 9 11 10 12 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 15 14 16 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" 17 18 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" 15 19 16 20 … … 51 55 LINE2:rainpd#729fcf 52 56 57 rrdtool graph web/regen_1jahr.png \ 58 --title "Regen im Jahresverlauf" \ 59 --font TITLE:12 -w 800 -h 500 \ 60 -s 'now - 1 year' -e 'now' \ 61 -v mm/Tag \ 62 DEF:rains9=weather.rrd:rains9:AVERAGE \ 63 CDEF:rainpd=rains9,3600,*,24,*,0.295,* \ 64 CDEF:rainpm=rainpd,30,* \ 65 VDEF:totalrain=rainpm,AVERAGE \ 66 GPRINT:totalrain:"Total %6.0lf mm/Jahr" \ 67 LINE2:rainpd#729fcf 53 68 54 69 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 72 58 73 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" 74 75 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" -
de.wigbels.ruby/hotcoldrain/hotcoldrain.rb
rb342b88 rc22952c 65 65 system("rrdtool update #{mypath}/weather.rrd #{rrddata}") 66 66 67 MQTT::Client.connect('mqtt://notwist:pixies@wigbels.net') do |c| 68 c.publish('oben/temperatur', datagrams[0]) 69 end 70 #log(INFO, 'added 100 liter of gas to sensor-database') 67 # MQTT::Client.connect('mqtt://notwist:pixies@wigbels.net') do |c| 68 # c.publish('oben/temperatur', datagrams[0]) 69 # end 71 70 end 72 71 @serialport.close -
de.wigbels.ruby/hotcoldrain/web/index.html
rb342b88 rc22952c 7 7 <img src="temperatur_1woche.png"> <img src="luftfeuchtigkeit_1woche.png"> <br /> 8 8 <img src="temperatur_1monat.png"> <img src="luftfeuchtigkeit_1monat.png"> <br /> 9 <img src="temperatur_1jahr.png"> <img src="luftfeuchtigkeit_1jahr.png"> <br /> 9 10 10 11 <h2>Regen / Wind</h2> … … 12 13 <img src="regen_1woche.png"> <img src="wind_1woche.png"> <br /> 13 14 <img src="regen_1monat.png"> <img src="wind_1monat.png"> <br /> 15 <img src="regen_1jahr.png"> <img src="wind_1jahr.png"> <br /> 14 16 15 17 <p>Stationskoordinaten: 53°34'17.1"N 9°29'21.8"E, Stade-Ottenbeck</p> -
de.wigbels.ruby/hothotread/draw_graphs.sh
rb342b88 rc22952c 11 11 CDEF:gash=gas,120,* \ 12 12 VDEF:gastotal=gas,TOTAL \ 13 GPRINT:gastotal:"Total %6.0lf m3Gas" \13 GPRINT:gastotal:"Total %6.0lf Liter Gas" \ 14 14 LINE2:gash#c17d11:"Gasverbrauch" 15 15 … … 22 22 CDEF:gasd=gas,2880,* \ 23 23 VDEF:gastotal=gas,TOTAL \ 24 GPRINT:gastotal:"Total %6.0lf m3Gas" \24 GPRINT:gastotal:"Total %6.0lf Liter Gas" \ 25 25 LINE2:gasd#c17d11:"Gasverbrauch/Tag" 26 26 … … 33 33 CDEF:gasd=gas,2880,* \ 34 34 VDEF:gastotal=gas,TOTAL \ 35 GPRINT:gastotal:"Total %6.0lf m3Gas" \35 GPRINT:gastotal:"Total %6.0lf Liter Gas" \ 36 36 LINE2:gasd#c17d11:"Gasverbrauch/Tag" 37 37 38 rrdtool graph web/gas_1jahr.png \ 39 -w 800 -h 500 \ 40 -s 'now - 1 year' -e 'now' \ 41 --title "Gasverbrauch im Jahresverlauf" \ 42 --font TITLE:12 --vertical-label="Liter/Tag" \ 43 DEF:gas=gas.rrd:gas:AVERAGE \ 44 CDEF:gasd=gas,2880,* \ 45 VDEF:gastotal=gas,TOTAL \ 46 GPRINT:gastotal:"Total %6.0lf Liter Gas" \ 47 LINE2:gasd#c17d11:"Gasverbrauch/Tag" 48 49 50 51 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]" 52 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]" 53 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]" 54 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]" 55 56 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]" 57 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]" -
de.wigbels.ruby/hothotread/hothotpiper.rb
rb342b88 rc22952c 19 19 20 20 #------------------------------------------ 21 require 'net/http'22 21 require 'pi_piper' 23 24 22 include PiPiper 25 23 … … 27 25 28 26 27 def last_rrd_count 28 val = 0.0 29 handle = IO.popen("rrdtool lastupdate #{$mypath}/power.rrd") 30 handle.each_line do |line| 31 m = line.match("^[0-9]*: ([0-9.]*) [0-9.]*") 32 if m 33 val = m[1].to_f 34 break 35 end 36 end 37 return val 38 end 39 40 29 41 watch :pin => 4, :trigger => :falling do 30 42 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 43 system("rrdtool update #{$mypath}/gas.rrd N:10") 33 44 end 34 45 46 watch :pin => 11, :trigger => :falling do 47 puts('updated power consumption') 48 $counter = $counter + $trigger_step 49 trigger_update = $trigger_step * 3600000.0 50 system("rrdtool update #{$mypath}/power.rrd N:#{$counter}:#{trigger_update}") 51 end 52 53 $trigger_step = 1.0 / 96 54 $counter = last_rrd_count 55 35 56 PiPiper.wait -
de.wigbels.ruby/hothotread/web/index.html
rb342b88 rc22952c 7 7 <img src="gas_1woche.png"> 8 8 <img src="gas_1monat.png"> 9 <img src="gas_1jahr.png"> 10 11 <h2>Strom</h2> 12 <img src="consum_1day.png"> 13 <img src="consum_1week.png"> 14 <img src="consum_1month.png"> 15 <img src="consum_1year.png"> 16 <img src="counter_1month.png"> 17 <img src="counter_1week.png"> 9 18 10 19 </body>
Note:
See TracChangeset
for help on using the changeset viewer.