Now we need something going the other direction: OWFS->weatherbug.
Paul
For those within North America:
I wrote this script to get (some) weather station output from weatherbug.com – my local high school (1/2 hile away from here) participates, and this script grabs their data.
Substitute your zip code into the script, and you're collecting from your nearest weatherbug weather station.
It prints out the current temp and humidity, there is other info on the page as well, such as wind speed, but I'm not interested in that right now. Add more lines such as the ugly 'sed' lines near the end of the script to yank out more information.
I have a simple script to insert this data into temploggerd/rrdtool. It's the second file included here. I'm using cron to take the samples right now… I have to look at temploggerd's scripts more closely and integrate it there sometime… ;-)
For now, I've just hacked the temploggerd web pages to include my data. Don't forget to create your .rrd files manually. (you can pull the command lines from temploggerd sources… which is what I did) That was the easy part – getting the wget's working with the cookies that they require was the tough part.
I hope someone finds this useful.
-Vince
--------GetWeatherbugData-------------
# get temp & humidity from local High School from Weatherbug.com
# settings
MYZIPCODE=07748
# tempfiles
STEP2=/tmp/step2.$$.html
STEP3=/tmp/step3.$$.html
COOKIES=/tmp/cookie$$.txt
# begin a session
/usr/bin/wget --save-cookies $COOKIES --keep-session-cookies http://web.live.weatherbug.com -O /dev/null 2>/dev/null
# set our location
/usr/bin/wget --save-cookies $COOKIES --keep-session-cookies \
" http://web.live.weatherbug.com/Common/Page/SetLocation.aspx?loc=$MYZIPCODE&x=21&y=10&no_cookie_world_stat=&zcode=$MYZIPCODE HTTP /1.1" -O $STEP2 2>/dev/null
# get the link out of our last retrieved page
LINK=`/bin/grep "to see more observations" $STEP2 | /usr/bin/tail -1 | /bin/sed 's/.*href="" | /bin/sed 's/class=.*//' | /bin/sed 's/\&\;/\&/g'`
# Fetch the page with temp & humidity
/usr/bin/wget --save-cookies $COOKIES --keep-session-cookies "$LINK" -O $STEP3 2>/dev/null
echo -n "Temperature "
/bin/sed -n -e '0,/Temperature/d' -e 'P' $STEP3 | /usr/bin/head -1 | /bin/sed -e 's/<[^>]*>//g' -e 's/[ \t]//g' -e 's/°F//' -e 's/%//' | /usr/bin/tr -d '\r'
echo -n "Humidity "
/bin/sed -n -e '0,/Humidity/d' -e 'P' $STEP3 | /usr/bin/head -1 | /bin/sed -e 's/<[^>]*>//g' -e 's/[ \t]//g' -e 's/°F//' -e 's/%//' | /usr/bin/tr -d '\r'
# clean up tempfiles
rm $STEP2 $STEP3 $COOKIES
-------end-----------
-------InsertData---------
#!/bin/sh
RRD_DIR=/var/www/html/temploggerd/rrd
WEATHERBUG=`/usr/local/bin/GetWeatherbugData`
TEMP=`echo $WEATHERBUG | awk '{ print $2 }'`
HUM=`echo $WEATHERBUG | awk '{ print $4 }'`
/usr/bin/rrdtool 2>&1 update $RRD_DIR/hum.weatherbug.rrd --template WEATHERBUGhumid N:$HUM
/usr/bin/rrdtool 2>&1 update $RRD_DIR/temp.weatherbug.rrd --template WEATHERBUGtempe N:$TEMP
-----------end-----------
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
_______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
