Ignore:
Timestamp:
03/03/2016 11:44:50 AM (9 years ago)
Author:
Norbert Wigbels <norbert.wigbels@…>
Branches:
master
Children:
8b9b145
Parents:
7e221fe (diff), 20d3261 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of wigbels.net:/var/git/public

Location:
de.wigbels.ruby/hothotread
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • de.wigbels.ruby/hothotread/draw_graphs.sh

    r7e221fe re397ced  
    11#!/bin/bash
    22
     3rrdtool graph web/gas_3hour.png -s 'now - 3 hour' -e 'now' DEF:consum=gasneu.rrd:consum:AVERAGE CDEF:conph=consum,3600,* CDEF:conpd=conph,24,* VDEF:gastotal=conpd,AVERAGE GPRINT:gastotal:"Total %4.2lf m³/d" LINE2:conph#c17d11:m³/h
     4rrdtool graph web/gas_6hour.png -s 'now - 6 hour' -e 'now' DEF:consum=gasneu.rrd:consum:AVERAGE CDEF:conph=consum,3600,* CDEF:conpd=conph,24,* VDEF:gastotal=conpd,AVERAGE GPRINT:gastotal:"Total %4.2lf m³/d" LINE2:conph#c17d11:m³/h
     5rrdtool graph web/gas_12hour.png -s 'now - 12 hour' -e 'now' DEF:consum=gasneu.rrd:consum:AVERAGE CDEF:conph=consum,3600,* CDEF:conpd=conph,24,* VDEF:gastotal=conpd,AVERAGE GPRINT:gastotal:"Total %4.2lf m³/d" LINE2:conph#c17d11:m³/h
    36rrdtool graph web/gas_1tag.png -s 'now - 1 day' -e 'now' DEF:consum=gasneu.rrd:consum:AVERAGE CDEF:conph=consum,3600,* CDEF:conpd=conph,24,* VDEF:gastotal=conpd,AVERAGE GPRINT:gastotal:"Total %4.2lf m³/d" LINE2:conph#c17d11:m³/h
    47rrdtool graph web/gas_1week.png -s 'now - 1 week' -e 'now' DEF:consum=gasneu.rrd:consum:AVERAGE CDEF:conpd=consum,3600,*,24,* LINE2:conpd#c17d11:m³/h
     
    1013
    1114
     15rrdtool graph web/consum_10minutes.png   -s 'now -10 minutes' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
     16rrdtool graph web/consum_30minutes.png   -s 'now -30 minutes' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
     17rrdtool graph web/consum_1hour.png   -s 'now -1 hour' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch[W]"
     18rrdtool graph web/consum_3hour.png   -s 'now -3 hour' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
     19rrdtool graph web/consum_6hour.png   -s 'now -6 hour' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
     20rrdtool graph web/consum_12hour.png   -s 'now -12 hour' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
    1221rrdtool graph web/consum_1day.png   -s 'now -1 day' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
    1322rrdtool graph web/consum_1week.png   -s 'now -1 week' -e 'now'   -Y -A   DEF:consum=power.rrd:consum:AVERAGE   LINE2:consum#00FF00:"Verbrauch [W]"
  • de.wigbels.ruby/hothotread/hothotpiper_gas.rb

    r7e221fe re397ced  
    11#!/usr/bin/env ruby
     2require 'pi_piper'
     3require 'eventmachine'
    24
    3 require 'pi_piper'
    45include PiPiper
     6
    57
    68mypath = File.expand_path(File.dirname(__FILE__))
     
    911counter = 0.0
    1012timestamp =  Time.now.to_i
     13
    1114
    1215def last_rrd_count(concretepath)
     
    2831end
    2932
     33
    3034rrdpath = mypath + "/gasneu.rrd"
    3135counter = last_rrd_count(rrdpath)
    32 puts('Counter restored to: '+counter.to_s)
     36puts('Counter restored to: ' + counter.to_s)
    3337
    34 loop do
    35   if trigger_watch == 1 then
    36     counter = counter + trigger_step
    37     system("rrdtool update #{rrdpath} N:#{counter}:#{trigger_step}")
    38     puts('Counter updated to: '+counter.to_s)
    39     timestamp =  Time.now.to_i
    40     trigger_watch = 0
    41   elsif Time.now.to_i - timestamp > 3600
    42     system("rrdtool update #{rrdpath} N:#{counter}:0")
    43     timestamp = Time.now.to_i
     38
     39EventMachine.run do
     40  EM.add_periodic_timer(1) do
     41    if trigger_watch == 1 then
     42      counter = counter + trigger_step
     43      system("rrdtool update #{rrdpath} N:#{counter}:#{trigger_step}")
     44      puts('Counter updated to: ' + counter.to_s)
     45      timestamp =  Time.now.to_i
     46      trigger_watch = 0
     47    elsif Time.now.to_i - timestamp > 3600
     48      system("rrdtool update #{rrdpath} N:#{counter}:0")
     49      timestamp = Time.now.to_i
     50    end
    4451  end
    45   sleep(1)
    4652end
    4753
  • de.wigbels.ruby/hothotread/hothotpiper_power.rb

    r7e221fe re397ced  
    11require 'pi_piper'
     2require 'eventmachine'
     3
    24include PiPiper
     5
    36
    47mypath = File.expand_path(File.dirname(__FILE__))
    58trigger_step = 1.0 / 96
     9trigger_watch = 0
    610counter = 0
     11
    712
    813def last_rrd_count(concretepath)
     
    1924end
    2025
    21 
    2226watch :pin => 11, :trigger => :falling  do
    2327  puts('updated power consumption')
    24   counter = counter + trigger_step
    25   trigger_update = trigger_step * 3600000.0
    26   system("rrdtool update #{rrdpath} N:#{counter}:#{trigger_update}")
     28  trigger_watch = 1
    2729end
     30
    2831
    2932rrdpath = mypath + "/power.rrd"
    3033counter = last_rrd_count(rrdpath)
    31 PiPiper.wait
     34puts('Counter restored to: ' + counter.to_s)
     35
     36
     37EventMachine.run do
     38  EM.add_periodic_timer(1) do
     39    if trigger_watch == 1 then
     40      counter = counter + trigger_step
     41      trigger_update = trigger_step * 3600000.0
     42      system("rrdtool update #{rrdpath} N:#{counter}:#{trigger_update}")
     43      puts('Counter updated to: ' + counter.to_s)
     44      trigger_watch = 0
     45    end
     46  end
     47end
  • de.wigbels.ruby/hothotread/web/index.html

    r7e221fe re397ced  
    33<body>
    44
     5<h2>Temperatur</h2>
     6<img src="../temperatur_1tag.png">
     7
    58<h2>Gas</h2>
     9<img src="gas_3hour.png">
     10<img src="gas_6hour.png">
     11<img src="gas_12hour.png">
    612<img src="gas_1tag.png">
    713<img src="gas_1week.png">
     
    1218
    1319<h2>Strom</h2>
     20<img src="consum_10minutes.png">
     21<img src="consum_30minutes.png">
     22<img src="consum_1hour.png">
     23<img src="consum_3hour.png">
     24<img src="consum_6hour.png">
     25<img src="consum_12hour.png">
    1426<img src="consum_1day.png">
    1527<img src="consum_1week.png">
Note: See TracChangeset for help on using the changeset viewer.