Och om ni är i behov av att lagra värderna i mysql så är det inte så svårt att bara lägga till.
Kod: Markera allt
#!/bin/bash
# temp_get.sh for owfs made by Plutonium 2010-06-08
# temperatur.nu
#
# Sensor's id
# (Name sensorid)
#
sensors=(
'Vinden 10.2A7A7C010800' # Uppe på vinden
'Växthuset 10.E68E7C010800' # Växthuset
'Vardagsrummet 10.B8957C010800' # Vardagsrummet
)
#
# 1wire dir
#
dir='/mnt/1wire'
#
# Temperatur destination
#
temp_dir='/home/plutonium/public_html/temperatur.txt'
#
# Log
#
# uncomment to use log function
#
#log='/var/log/1wire_temp.log'
#
# Process sensor's
#
# No Need To Change anything below this line!
#
function check_valid() {
temp_int=${temp/.*}
if [ $temp_int -eq '85' ] || [ ! -n "${temp_int-x}" ]; then
temp="NAN"
if [ -n "${log:+x}" ]; then
echo `date +%Y-%m-%d\ %k:%M` $id $name "temp:" $temp >> $log
fi
fi
}
rm $temp_dir
for (( i = 0 ; i < ${#sensors[@]} ; i++ ))
do
id=`echo ${sensors[$i]}|awk '$0=$2'`
name=`echo ${sensors[$i]}|awk '$0=$1'`
temp=`grep . $dir/$id/temperature | sed -e s/" "//g`
check_valid $temp
echo $temp $name >> $temp_dir
done