Langue English Jêzyk Polski

Sending data to www.wunderground.com, www.pwsweather.com

In the event that service data is sent through our network in a very simple form. We must send a request to download the appropriate web page and our data are sent in a properly crafted URL.

To send your measurements on the side of the site include:
Below is a bash script fragment which, after minor adapt to their own station will send the selected data
#----------------------------------------------------------------
# prepare data to send (check to see if they are!)

# instead of $outdoor_temp insert my variable which is to record the outdoor
# temperature
if [ "$outdoor_temp" ] ;then
  # replace degrees C to F, round up and substitute the variable
  w_ot=`echo "scale=3 ;($outdoor_temp * 1.8) + 32" |bc |awk '{printf "tempf=%.1f&\n", $1}'`
fi

# instead of $DewP insert my variable which is to record the dew point
if [ "$DewP" ] ;then
  # replace degrees C to F, round up and substitute the variable
  w_dp=`echo "scale=3 ;($DewP * 1.8) + 32" |bc |awk '{printf "dewptf=%.1f&\n",$1}'`
fi

# instead of $outdoor_hum insert your own variable which is the record of
# moisture
if [ "$outdoor_hum" ] ;then
  # round up and substitute the variable
  w_hu=`echo "$outdoor_hum" |awk '{printf "humidity=%.1f&\n", $1}'`
fi

# $pres_rel insert your own instead of a variable in which the record is
# sea level pressure
if [ "$pres_rel" ] ;then
  # recalculate the inchHg hPa (inchHg = hPa/33.863), rounded, and
  # substitute
  p_in=`echo "scale=3 ;$pres_rel / 33.863" |bc |awk '{printf "baromin=%.1f&\n",$1}'`
fi

# the individual variables we have data in the form of eg $p_in is:
# baromin=30.1&
# Now all the data folded and eat the last &
wun_send=`echo "$w_ot$w_dp$w_hu$p_in" |sed 's/&$//'`

# sent only if we have anything to send
if [ "$wun_send" ] ;then
  # ID stacji
  stid="IWIELKOP00"
  # password
  pass="here our password"

  # remove the # in front of one of the following addresses
  #url="http://weatherstation.wunderground.com/weatherstation/updateweatherstation.php"
  #url="http://www.pwsweather.com/pwsupdate/pwsupdate.php"

  # format YYYY-MM-DD HH:MM:SS
  # spacje kodujemy znakiem +, : kodujemy %3A
  # spaces encode +, colon encode %3A
  dat=`date -u '+%Y-%m-%d+%H%%3A%M%%3A%S'`

  # make to one of the authentication data and date
  auth="ID=$stid&PASSWORD=$pass&dateutc=$dat"

  # send data. Result operation (so you can preview the effect of its
  # implementation) is written in the file /tmp/rrd/debug_send.txt (this
  # file is overwritten after every request) - if all goes well it will read:
  # "success" for the www.wunderground.com
  # "Data Logged and posted in METAR mirror." for the www.pwsweather.com
  elinks -dump "$url?$auth&$wun_send&action=updateraw" >/tmp/rrd/debug_send.txt 2>&1 &
fi
#

A full description of the protocol together with the data that you can send.


Personal Weather Station.
icon IPv4 Home automation www.tomkii.net/tech/pomiary/ Jêzyk Polski - what I measure, which devices I use, and how do I use them.
Forum forum.tomkii.net/forum-5.html Jêzyk Polski

Contact e-mail: Napisz@Tomkii.net
Last Modified: 2011-06-12