aprx and weather reporting

I’ve been sending weather reports via APRS-IS and RF for some years and have recently re-architected the way it works.  My APRS station uses aprx software running on a Raspberry Pi Model B.

My weather station is a Davis Vantage Vue with WeatherLinkIP module. The module allows the weather station to plug directly into my ethernet network. I formerly used WeatherLinkIP to feed the data to CWOP which would in turn show up on APRS-IS.  I would then gateway my reports back to RF using an aprx filter.  This seemed convoluted to me, so I wanted to improve things.

I now use a program called Weather Display, a very capable weather program, which has the capability to generate an APRS WXNOW.TXT file.  Weather Display can directly poll the Davis station via IP.  Through the steps documented below, I now send my weather reports via RF and APRS-IS in the same step.

Every 10 minutes, via crond, I perform some preprocessing on the WXNOW.TXT file to embed the weather report in the APRS “Complete Weather Report Format — with Lat/Long position and Timestamp” and then secure copy the file over to my Raspberry Pi APRS system:

if [ ! -f ~/tmp/WXNOW.TXT ]; then
   exit 1
# Change to the Lat/Long of your weather station
while read FILE; do
   if [ $line = 0 ]; then
      # Change America/New_York to your timezone
      TIME=`TZ=UTC date --date="TZ=\"America/New_York\" $FILE" +%d%H%M`
done < ~/tmp/WXNOW.TXT # echo /$TIME\z$LATLONG\_$WX > ~/tmp/wxnow.tmp
echo `cat ~/tmp/wxnow.tmp | tr -d '\r'`XDsIP > ~/tmp/wxnow.txt
# You must setup ssh key based authentication for this to work
# Another method could be a file copy via NFS or CIFS
scp ~/tmp/wxnow.txt pi@aprs:/dev/shm/wxnow.txt
rm ~/tmp/wxnow.txt ~/tmp/wxnow.tmp

On the APRS host, I defined the following beacon section in /etc/aprx.conf:

beaconmode both
cycle-size 10m

beacon via WIDE2-1 \
srccall N0CALL-13 \
exec /usr/local/bin/aprx-wxnow.sh

Finally, the beacon exec script, is installed in /usr/local/bin/aprx-wxow.sh:

TIME=$(printf `date -u "+%d%H%M"`)
if [ -f /dev/shm/wxnow.txt ]; then
   if [ -f /dev/shm/wxold.txt ]; then
      FULLWXOLD=`cat /dev/shm/wxold.txt`
   FULLWXNOW=`cat /dev/shm/wxnow.txt`
   if [ "$FULLWXOLD" == "$FULLWXNOW" ]; then
      # Convert date/times to minutes for date arithmetic
      CURDAY=`echo $TIME | cut -b 1-2`
      OLDDAY=`echo $FULLWXOLD | cut -b 2-3`
      CURHR=`echo $TIME | cut -b 3-4`
      OLDHR=`echo $FULLWXOLD | cut -b 4-5`
      CURMIN=`echo $TIME | cut -b 5-6`
      OLDMIN=`echo $FULLWXOLD | cut -b 6-7`
      CURTIME=$((10#$CURDAY * 1440 + 10#$CURHR * 60 + 10#$CURMIN))
      OLDTIME=$((10#$OLDDAY * 1440 + 10#$OLDHR * 60 + 10#$OLDMIN))
      # If report older than 20 minutes then not updating
      if (( $(($CURTIME-$OLDTIME)) > 20 )) ; then
         echo -n \>$TIME\z
         echo " WX rpt not updating"
         exit 0
      # Unchanged report but <= 20 min old then don't transmit
      exit 0
      OLDRPT=`echo $FULLWXOLD | cut -b 9-`
      NEWRPT=`echo $FULLWXNOW | cut -b 9-`
      #if new and old report are same then don't transmit
      if [ "$OLDRPT" == "$NEWRPT" ]; then
         exit 0
      # Transmit report and copy wxnow.txt to wxold.txt
      echo $FULLWXNOW cp /dev/shm/wxnow.txt /dev/shm/wxold.txt
   echo -n \>$TIME\z
   echo " WX rpt not found"

While debugging, I noticed that the wxnow.txt file would sometimes disapper from /dev/shm.  This turned out to be systemd cleaning up interprocess communication whenever the pi user logged out.  I fixed this by adding the following line to /etc/systemd/logind.conf:


Following this change, you must restart systemd-logind.service:

sudo systemctl restart systemd-logind.service

If you implement this on your aprx system, please leave a comment.