I have some temperature sensors hooked up and one of them happens to be outdoors. I use owfs and wanted to upload my temperature readings to www.wunderground.com and the Citizen Weather Observation Program (just google CWOP; the benefit here is they analyze your data for you & compare to others so you know how accurate your readings are). In any case all the info I found was for oww, so I just made this script that I am using and works well for me. Pretty self explanatory (hopefully), just save in /usr/bin (I call it temp-upload), chmod +x /usr/bin/tempupload, and make the appropriate crontab entry. Will work with just wunderground or CWOP upload, just leave the other username blank.
#!/bin/sh
#
# Upload OWFS temperature sensor data to wunderground.com and CWOP
#
# This script can be run in crontab once every ten minutes as follows:
# 1,11,21,31,41,51 * * * * /usr/bin/temp-upload > /dev/null 2>&1
#
#
# Customize variables below
#
# Change the below if you are _not_ uploading every ten minutes
RTFREQ="360"
# OWFS path and temperature sensor to read
OWFS="/tmp/1wire/uncached"
SENSOR="10.9C9E6B010800"
# Wunderground information
WUNDERGROUNDID=""
WUNDERGROUNDPASS=""
# CWOP information, latitude is ddmm.hhN and longitude is dddmm.hhW where dd is degrees, mm is minutes, and
# hh is hundreds of minutes
CWOPID=""
LATITUDE=""
LONGITUDE=""
#
# Constants
#
# Program version
VERSION="1.00"
# Standard error
STDERR="/proc/self/fd/2"
# CWOP telnet session?
if [ $# -gt 0 ] && [ $1 = "cwop-telnet-session" ]; then
# 3 digit temperature
if [ ${2} -lt 10 ]; then
TEMP="00${2}"
elif [ ${2} -lt 100 ]; then
TEMP="0${2}"
else
TEMP="${2}"
fi
sleep 1
echo "user ${CWOPID} pass -1 vers mk-linux-1wire ${VERSION}"
sleep 3
echo "${CWOPID}>APRS,TCPX**:!${LATITUDE}/${LONGITUDE}_.../...g...t${TEMP}mk1"
sleep 3
exit
fi
# Round the temperature to an integer, first parameter is sensor name. Returns temperature.
roundtemp()
{
local T
for i in 1 2 3
do
if ! [ -f ${OWFS}/${1}/temperature ]; then
echo "cannot stat temperature file ${OWFS}/${1}/temperature (try ${i})" > ${STDERR}
else
T=`printf "%s\n" "scale=0" "($(cat ${OWFS}/${1}/temperature)+0.5)/1" | bc`
if [ ${T} = 185 ]; then
echo "bad temperature reading ${T} (try ${i})" > ${STDERR}
else
echo ${T}
return
fi
fi
sleep 10
done
echo -1
}
# Get temperature
TEMPF=`roundtemp ${SENSOR}`
if [ ${TEMPF} = -1 ]; then
echo aborted > ${STDERR}
exit
fi
# Upload to wunderground
if ! [ "" = ${WUNDERGROUNDID:-""} ]; then
echo Uploading to wunderground...
URL="http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=${WUNDERGROUNDID}"
URL=${URL}"&PASSWORD=${WUNDERGROUNDPASS}"
URL=${URL}"&dateutc=$(date -u "+%F+%H%3A%M%3A%S")"
URL=${URL}"&tempf=${TEMPF}"
URL=${URL}"&softwaretype=customShellScript&action=updateraw&realtime=1&rtfreq=${RTFREQ}"
wget -q -O - ${URL}
fi
# Upload to CWOP
if ! [ "" = ${CWOPID:-""} ]; then
echo Uploading to CWOP...
$0 cwop-telnet-session ${TEMPF} | telnet cwop.aprs.net 14580
fi
Misha