Thanks for the reply kscott9.
I also am using DIGITEMP . I have 6 temperature sensors(DS18B20) and one USB to 1-Wire Adapter (DS9490R ). As part of the Digitemp package there is digitemp_DS2490 command, which can be used to query the sensors,when the 1-wire devices are connected with USB-1-wire adapter.
I have used cron, to schedule collection each minute. For 6 sensors it needs 5-10 seconds. The load on the router is negligible. After collection, I use rrd to store and graph ecah sensor. I create separate database for each sensor.
This is the script I run each minute to collect data from termo sensors.
Code:
#!/bin/sh
log="/tmp/var/log/temperature.log"
err_log="/tmp/var/log/digitemp.log"
home="/opt/var/lib/rrd/digitemp"
date=`date "+%Y-%m-%d %H:%M:%S"`
#Check if we have Digitemp configuration file. If not start "digitemp -i"
if [ ! -f ${home}/.digitemprc ]; then
/opt/bin/digitemp_DS2490 -i -c ${home}/.digitemprc
echo "$date Creating new Digitemp configuration file ($home/.digitemprc)" >>$err_log
fi
#Read the temperature and store it into a variable t
t=`/opt/bin/digitemp_DS2490 -q -a -o"%R %4.1C" -c ${home}/.digitemprc`
#Teake the number of sensore and assign it to varaible c
c=`echo "$t" | wc -l`
#Check if we have values from all sensors. Current number of sensors is 6
if [ $c -ne 6 ]; then
echo "$date ERROR ! Missing Value. Only $c values were detected ! Wrong number of sensors." >> $err_log
echo "$t" >> $err_log
fi
# Loop, read each valua and add it to the database. Odd values are sensor ID. Even values are temperatures
i=1
for LINE in $t ; do
let "odd = $i % 2"
if [ $odd -eq 1 ]; then
Sensor=$LINE
else
Temperature=$LINE
# hertbeat on every 60s ( 1min.)
# 1:1500 -> 1500 sample per every 1min -> 25h ( 1 day + 1 hour )
# 5:2160 -> 2100 sample per every 5min -> 180h ( 1 week + 0.5 day )
# 15:3024 -> 3024 sample per every 15min -> 756h ( 1 month + 0.5 day )
# 240:2190 -> 2190 sample per every 4h -> 8760h ( 365 days )
if [ ! -e ${home}/${Sensor}.rrd ]; then
echo "Creating new database for Sensor $Sensor " >> $err_log
/opt/bin/rrdtool create ${home}/${Sensor}.rrd \
--step 60 \
DS:temp:GAUGE:100:-40:100 \
RRA:AVERAGE:0.5:1:1500 \
RRA:AVERAGE:0.5:5:2160 \
RRA:AVERAGE:0.5:15:3024 \
RRA:AVERAGE:0.5:240:2190
fi
#Updating the temperature
/opt/bin/rrdupdate ${home}/${Sensor}.rrd N:${Temperature}
fi
let i=i+1
done
I have one problem, there are 10-20 times each 24 hours, when some of the sensors is not returning value, that is why I'm checking for number of sensors each time and log error for this in the error log file.
I read a little bit more regarding owfs support and it seems to need Fuse. There is a problem with fuse on Oleg's firmware. It seems to be the kernel version.
http://wl500g.info/showthread.php?t=...highlight=Fuse
http://wl500g.info/showthread.php?t=...highlight=Fuse
There is new version based on Oleg's firmware called 1.9.2.7-d from enthusiasts, but I haven't tested it yet. So it seems that with Oleg's latest version 1.9.2.7-10 we don't have any other option than using Digitemp.