#!/bin/sh # # # http://www.golem.de/projekte/ot/doku.php # http://www.golem.de/projekte/ot/temp.php?temp=21.235&dbg=0&type=sbc&country=DE&zip=10969&city=Berlin&lat=52.50&long=13.41 . ./golem-config.sh TTY=/dev/ttyUSB0 TEMP="33.8" PFX="http://www.golem.de/projekte/ot/temp.php?temp=" SFX="" if [ -n "$DEBUG" ]; then SFX="$SFX&dbg=$DEBUG" fi if [ -n "$TYPE" ]; then SFX="$SFX&type=$TYPE" fi if [ -n "$COUNTRY" ]; then SFX="$SFX&country=$COUNTRY" fi if [ -n "$ZIP" ]; then SFX="$SFX&zip=$ZIP" fi if [ -n "$CITY" ]; then SFX="$SFX&city=$CITY" fi if [ -n "$LAT" ]; then SFX="$SFX&lat=$LAT" fi if [ -n "$LON" ]; then SFX="$SFX&lon=$LON" fi if [ -n "$TOKEN" ]; then SFX="$SFX&token=$TOKEN" fi #echo "URL=$URL" #wget -q -O /dev/null "$URL" #RC=$? #echo "RC=$RC" T=`expr 60 \* 15` T=5 I=$T stty -F $TTY raw ispeed 9600 ospeed 9600 cs8 -ignpar -cstopb -echo cat $TTY | while read LINE; do case $LINE in [+-]*) #echo "got $LINE" I=`expr $I + 1` if [ $I -ge $T ]; then # echo ">> $LINE <<" TEMP=`echo "$LINE" | sed 's/[^0-9.+-]//g'` #echo "TEMP >> $TEMP << TEMP" URL="$PFX$TEMP$SFX" #echo ">> $PFX <<" #echo "----" echo ">> $URL <<" wget -q -O /dev/null "$URL" RC=$? echo "RC=$RC" if [ $RC = 0 ]; then I=0 fi fi ;; esac done