#!/bin/sh # Diesen Pfad anpassen! BASE=/usr/local/ export PATH=$BASE/bin:$PATH export LD_LIBRARY_PATH=$BASE/lib/w1retap/:$LD_LIBRARY_PATH if ! test "`whoami`" = "root" then echo "Du musst root sein" exit 0 fi for I in 0 1 2 3 4 5 6 7 8 9 10 do T=`w1find DS2490-$I` if test "`echo $T | grep ^Error `" = "" then DEVICE="DS2490-$I" break fi done echo "USB-Adapter gefunden: $DEVICE" if ! test -e ~/.config then mkdir ~/.config fi if ! test -e ~/.config/w1retap then mkdir ~/.config/w1retap fi if ! test -e ~/.config/w1retap/rc then cat > ~/.config/w1retap/rc <<_EOF_ init = w1file log = w1csv=/tmp/csvlog.txt altitude = 120 delay = 10 device = $DEVICE _EOF_ fi SENSORFILE=~/.config/w1retap/sensors if ! test -e $SENSORFILE then ALLIDS="" TX=/tmp/w1.$$ w1find $DEVICE > $TX while read I do if ! test "`echo $I | grep 18S20:`" = "" then ID=`echo $I | grep "18S20:" | awk {'print $2'} ` if test "`echo $ALLIDS`" = "" then ALLIDS=$ID else ALLIDS="$ALLIDS,$ID" fi echo "$ID:1820:ST:Sensor $ID:C:::" >>$SENSORFILE echo "$ID:1820:ST:Sensor $ID:C:::" fi if ! test "`echo $I | grep 'Serial ID Button'`" = "" then CID=`echo $I | grep "Serial ID Button" | awk {'print $2'} ` fi done < $TX echo "$CID:Coupler:MAIN:$ALLIDS::AUX:::" >> $SENSORFILE echo "$CID:Coupler:MAIN:$ALLIDS::AUX:::" fi w1retap -v