#!/bin/bash #Liest die Werte des Stromzählers DVS74 (alte Version mit "D0-ähnlicher" Ausgabe) INPUT_DEV="/dev/ttyUSB0" stty -F $INPUT_DEV 1:0:8bd:0:0:0:0:0:4:5:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 typeset -i i=0 while read line; do if [ ${line:0:18} == "01-00:01.08.00.FF(" ] then BEZUG_GESAMT=$(echo ${line:18} | cut -d '*' -f1) i=i+1 elif [ ${line:0:18} == "01-00:02.08.00.FF(" ] then EINSPEISUNG_GESAMT=$(echo ${line:18} | cut -d '*' -f1) i=i+1 fi if (($i == 2 )) then break; fi done < $INPUT_DEV curl -s "http://localhost/middleware.php/data/6836dd20-00d5-11e0-bab1-856ed5f959ae.json?operation=add&value=$BEZUG_GESAMT" > /dev/null curl -s "http://localhost/middleware.php/data/6836dd20-00d5-11e0-bab1-856ed5f959aa.json?operation=add&value=$EINSPEISUNG_GESAMT" > /dev/null