diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2011-02-05 12:57:28 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2011-02-05 12:57:28 +0100 |
| commit | 191677e1271e0262f557efcbea6f56e2f557990c (patch) | |
| tree | 837ba436a58977daa385142b99c430d6bfb67be6 | |
| parent | 98bdda0e32e25c05d6bbfe7eca7c67c7957b95f8 (diff) | |
| download | usb-wde1-tools-191677e1271e0262f557efcbea6f56e2f557990c.tar.gz usb-wde1-tools-191677e1271e0262f557efcbea6f56e2f557990c.zip | |
move own scripts to own directory
| -rw-r--r-- | own/README | 36 | ||||
| -rw-r--r-- | own/create-rdd.sh | 21 | ||||
| -rw-r--r-- | own/lines-to-stdout.php | 9 | ||||
| -rw-r--r-- | own/multilinefile | 6 | ||||
| -rw-r--r-- | own/temperature.rrd | bin | 0 -> 118056 bytes | |||
| -rwxr-xr-x | own/work-with-lines.sh | 26 |
6 files changed, 98 insertions, 0 deletions
diff --git a/own/README b/own/README new file mode 100644 index 0000000..6cf6757 --- /dev/null +++ b/own/README @@ -0,0 +1,36 @@ +usb-wde1 tools +-------------- +Tools to collect and analyze data from the USB-WDE1 weather receiver from ELV.de + + +idea +---- +1. pipe each received line to a command +2. command splits up line into variables +3. add variable data to rrdtool +4. repeat + + +idea: cat socat output to "read" + + + +Test it: +$ php lines-to-stdout.php | ./work-with-lines.sh + + + + +RRDtool database setup +---------------------- +EXAMPLE + rrdtool create temperature.rrd --step 300 \ + DS:temp:GAUGE:600:-273:5000 \ + RRA:AVERAGE:0.5:1:1200 \ + RRA:MIN:0.5:12:2400 \ + RRA:MAX:0.5:12:2400 \ + RRA:AVERAGE:0.5:12:2400 + + This sets up an RRD called temperature.rrd which accepts one temperature value every 300 seconds. If no new data is supplied for more than 600 seconds, the temperature becomes *UNKNOWN*. The minimum acceptable value is -273 and the maximum is 5'000. + + A few archive areas are also defined. The first stores the temperatures supplied for 100 hours (1'200 * 300 seconds = 100 hours). The second RRA stores the minimum temperature recorded over every hour (12 * 300 seconds = 1 hour), for 100 days (2'400 hours). The third and the fourth RRA's do the same for the maximum and average temperature, respectively. diff --git a/own/create-rdd.sh b/own/create-rdd.sh new file mode 100644 index 0000000..78f11b8 --- /dev/null +++ b/own/create-rdd.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# data will be collected ~ every 3 minutes (150s) +# after 600s (10min) data are "unknown" +# archives: +# - store avg temperature on every data point for 1day (576*150s) +# +# - store avg temperature every 10 minutes for 1 week (6*24*7 = 1008) +# - store min temperature -"- +# - store max temperature -"- +# +# - store avg temperature every day for 10 years + +for i in 1..8 +rrdtool create sensor-$1.rrd --step 150 \ + DS:temp:GAUGE:600:-273:5000 \ + DS:humidity:GAUGE:600:0:100 \ + RRA:AVERAGE:0.5:1:576 \ + RRA:AVERAGE:0.5:4:1008 \ + RRA:MIN:0.5:4:1008 \ + RRA:MAX:0.5:4:1008 \ + RRA:AVERAGE:0.5:576:3650 diff --git a/own/lines-to-stdout.php b/own/lines-to-stdout.php new file mode 100644 index 0000000..eb6b39d --- /dev/null +++ b/own/lines-to-stdout.php @@ -0,0 +1,9 @@ +<?php + +$n = 0; +while ($n < 4) { + echo $n++ . ';col2;col3;col4' . "\n"; + sleep(1); +} + +?>
\ No newline at end of file diff --git a/own/multilinefile b/own/multilinefile new file mode 100644 index 0000000..00c077e --- /dev/null +++ b/own/multilinefile @@ -0,0 +1,6 @@ +line1 +line2 +line3 +a +b +c diff --git a/own/temperature.rrd b/own/temperature.rrd Binary files differnew file mode 100644 index 0000000..780429c --- /dev/null +++ b/own/temperature.rrd diff --git a/own/work-with-lines.sh b/own/work-with-lines.sh new file mode 100755 index 0000000..9e52c9d --- /dev/null +++ b/own/work-with-lines.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +#split words by semicolons +IFS=";" + +#Beispielausgabe USB-WDE1: +# $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0 +# Doku des Formats in 92030_USB_WDE1_V1.0_UM.pdf bei elv.de verfügbar + +#Variablenamen: +# t1-t8: Temperatur in °C der Sensoren 1-8 +# f1-f8: Feuchtegrad in % der Sensoren 1-8 +# tc: Temperatur Kombinsensor in °C +# fc: Feuchtegrad Kombinsensor in % +# wg: Windgeschwindigkeit in km/h +# ns: Niederschlag (Wippenschläge) +# regen: Regen 1=ja, 0=nein +while read -r startzeichen zustand zeitstempel\ + t1 t2 t3 t4 t5 t6 t7 t8\ + f1 f2 f3 f4 f5 f6 f7 f8\ + tc fc wg ns regen +do + echo "line:" + echo 1: $one , 2: $two, 3: $three, 4: $four +done +echo "done with everything" |
