From 191677e1271e0262f557efcbea6f56e2f557990c Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 5 Feb 2011 12:57:28 +0100 Subject: [PATCH] move own scripts to own directory --- own/README | 36 ++++++++++++++++++++++++++++++++++++ own/create-rdd.sh | 21 +++++++++++++++++++++ own/lines-to-stdout.php | 9 +++++++++ own/multilinefile | 6 ++++++ own/temperature.rrd | Bin 0 -> 118056 bytes own/work-with-lines.sh | 26 ++++++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 own/README create mode 100644 own/create-rdd.sh create mode 100644 own/lines-to-stdout.php create mode 100644 own/multilinefile create mode 100644 own/temperature.rrd create mode 100755 own/work-with-lines.sh 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 @@ + \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..780429cbac3d8f35eb623c74c9da3383c031aa08 GIT binary patch literal 118056 zcmeIzJx&5a6ae7$uQhrCD+^;GiItUr5@LY`i3VevB1?*FtP112T@y>&ES9 z%5veXTpH=DB@^oPZ``%}KR>WM#IcY4sZlRWxO2tLjowm=#^>`Y|bBGdR_49&}4a1NXU=fHcw0S<70103K02ROh14sd`2 z9N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8 zaDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0W zzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h z00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70 z103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh1 z4sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4 zIKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G z-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$ zfCC)h00%h00S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h0 z0S<70103K02ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K0 z2ROh14sd`29N+*4IKTl8aDW3G-~b0WzyS_$fCC)h00%h00S<70103K02ROh14sd`2 d9N+*4IKTl8aDW3G-~b0WzyS_$;Qu)gMc>lHjJW^+ literal 0 HcmV?d00001 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" -- 2.30.2