diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2011-01-27 22:11:49 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2011-01-27 22:11:49 +0100 |
| commit | 52447f70cc29857f37dc4ef6a3e4f10d5fd5c110 (patch) | |
| tree | c9ee4fe13f110696c0670f2b199bff3ab4816894 | |
| download | usb-wde1-tools-52447f70cc29857f37dc4ef6a3e4f10d5fd5c110.tar.gz usb-wde1-tools-52447f70cc29857f37dc4ef6a3e4f10d5fd5c110.zip | |
beginning to work on the tools :)
| -rw-r--r-- | README | 12 | ||||
| -rw-r--r-- | lines-to-stdout.php | 9 | ||||
| -rw-r--r-- | multilinefile | 6 | ||||
| -rwxr-xr-x | work-with-lines.sh | 26 |
4 files changed, 53 insertions, 0 deletions
@@ -0,0 +1,12 @@ +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 diff --git a/lines-to-stdout.php b/lines-to-stdout.php new file mode 100644 index 0000000..eb6b39d --- /dev/null +++ b/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/multilinefile b/multilinefile new file mode 100644 index 0000000..00c077e --- /dev/null +++ b/multilinefile @@ -0,0 +1,6 @@ +line1 +line2 +line3 +a +b +c diff --git a/work-with-lines.sh b/work-with-lines.sh new file mode 100755 index 0000000..9e52c9d --- /dev/null +++ b/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" |
