Once again I am plagued by a failure to document problems I encountered and figured out.
Devoted a good portion of yesterday to getting weewx back into operation after a version upgrade took it down.
Part of that involved me figuring out (again) how to get the weewx extension working that creates the wxnow.txt file that Xastir uses to create and send APRS weather data.
Here’s an example of what Xastir was sending out:
The error is “h05” as humidity is not 5%. The problem is that Xastir wants a two digit humidity data value and wxcn is sending a three digit value.
In examining the old copy of wxcn.py I see the comments I placed in the file:
# fields.append(“h%03d” % int(data[‘outHumidity’]))
# changing value “h%03d” to “h%02d”
… and the line now appears as:
fields.append(“h%02d” % int(data[‘outHumidity’]))
I updated these comments in the new version of this file as it appears in /home/weewx/bin/user/cwxn.py
With the correction, here is what Xastir is now beaconing:
Now the humidity is given as “h59” instead of “h05”.
I am pretty sure that this concludes all the tweaks and fixes I had to make to get weewx working with Xastir to work properly. Time will tell.
A break down of the Xastir/APRS weather data string:
@071426z – “07” is the calendar day, “1426z” is the time
3913.63N/09454.49W – location
166 – wind direction
007 – wind speed
g011 – gust, peak winds in last five minutes
t051 – temperature
r000 – rain within last 60 minutes
P000 – rain within last 24 hours since midnight
p000 – rain per last 24 hours (sliding 24 hour window)
h59 – humidity
b10172 – barometric pressure
I started to prepare for the 0700 Kansas 80m weather net (3920 KHz, 1300-1330Z) this morning and discovered that weewx had stopped pulling in weather data after an update the previous evening.
When weewx upgraded to v5.0.1 and the bottom fell out. Checking the weewx users group, many were having the same problem.
The consensus was to go back to v4.10.2 – if that was reinstalled, everything would work as normal. Not the case for me.
- Throughout the process I kept thinking that mysql had been corrupted or I otherwise had to reconfigure mysql. That does not appear to be the case. Although I have not yet tried to get a status. I would assume weewx would not be working if mysql was not, but I took poor notes setting up mysql and am not sure of where to start. But I do need to find the notes that I did take.
- I also tried to used Minicom to verify I was getting data through the serial port. Unsuccessful in getting Minicom working to show a stream of incoming data. I need to be able to figure that out. (sudo minicom -D /dev/ttyS7)
Here is what did work:
- the whole time I am using the following command to monitor what is happening:
sudo tail -f /var/log/syslog
- Backed up my weewx.conf files. This was super helpful to use as a reference to see what everything looked like when fully operational.
- Followed the directions for uninstalling weewx but retaining configuration and data.
sudo apt remove weewx
I then created a folder under /home called weewx. I then moved weewx-4.10.0.tar.gz into the weewx folder. And installed it, knowing I had already met the prerequisites.
sudo python3 ./setup.py build
sudo python3 ./setup.py install
- to run the weewx
- to get weewx to start on boot:
sudo cp util/systemd/weewx.service /etc/systemd/system (I did this and it is working)
- watching the syslog I could see there were problems. Assumption is that the weewx.conf file was not correct.
- Used old weewx.conf file to make appropriate changes to the new one. In addition to telling weewx what kind of weather station I have, I also had to make sure it was set to ID 2 (somewhat out of the ordinary).
- After that I was able to setup Wunderground quickly with the correct information.
- Using sudo systemctl restart weewx, I could see from the syslog that data was flowing to Wunderground.
- I started the script that has Xastir look at wxnow.txt and then started Xastir. Both the network and radio interfaces came up without issue. I made a test TRANSMIT NOW and saw it was using the old data.
- Checking /var/tmp/wxnow.txt I could tell the file had not been updated since the upgrade to v5.0.1.
- A blog entry I wrote had a link to the extension I needed to reinstall that would regularly update the wxnow.txt file but also lacked detail.
- Following the instructions on github also were not sufficient. [I believe the extension is called CumulusWXNow]
- This worked:
wget -O weewx-cwxn.zip https://github.com/matthewwall/weewx-cwxn/archive/master.zip
The next direction given is: wee_extension –install weewx-cwxn.zip
… the problem is that linux does not know where to look for wee_extension
What worked… I found advice that said: try specifying the full path to wee_extension
sudo /home/weewx/bin/wee_extension –install weewx.cwxn.zip
- This install process also made the necessary changes to weewx.conf and after sudo systemctl restart weewx I checked wxnow.txt – it was now getting the latest data. The change includes an entry at the bottom of weewx.conf:
filename = /var/tmp/wxnow.txt
… there is also an addition made in the section above that I could identify by comparing old and new weewx.conf files.
- I started the Xastir script to grab the wxnow.txt data…
cd /usr/local/share/xastir/scripts then sudo ./wxnowsrv.pl /var/tmp/wxnow.txt 60 5500
- Bringing both the network and radio interfaces UP I did another TRANSMIT NOW from Xastir. Checking on aprs.fi I could see that the most current data was beaconing out.
- At some point syslog was showing the weewx did not have permission to use the serial port to get the data from the Davis console. I tried “rebooting” the console; the only way to do that is to remove the power and batteries, which I did. This did not fix the issue. Then I saw this recommendation: “In case anyone else runs into this – my Ubuntu server/Davis VP2 and serial datalogger had ownership set to root:dialout, so I had to add the weewx user to the dialout group for things to work.” The command I used was sudo adduser weewx dialout. I believe this fixed the permissions issue. Requires a full reboot.
- I am going to store copies of weewx-4.10.0.tar.gz and weewx-cwxn.tgz locally. Would also make sense to do the same for Xastir.
Just in case, the commands for completely removing weewx:
sudo apt purge weewx
sudo rm -r /var/www/html/weewx
sudo rm -r /var/lib/weewx
sudo rm -r /etc/weewx
sudo rm /etc/default/weewx
sudo userdel weewx
sudo gpasswd -d $USER weewx
sudo groupdel weewx
This link includes an example of installing an extension. This may be useful and worth a look.
Rebooting and seeing if everything will work:
sudo tail -f /var/log/syslog
– this should show weewx sending wx data to Wunderground
cd /usr/local/share/xastir/scripts then sudo ./wxnowsrv.pl /var/tmp/wxnow.txt 60 5500
checked wxnow.txt and it is being updated
From Xastir’s menu: View/Incoming Data
- Device 0 Network WX: Start
- Device 2 Serial TNC: Start
(note: Serial TNC say ttyS6 when weewx is set to ttyS7… investigate!)
With both started, incoming data should be coming across the Display Packet Data window.
From Xastir’s menu: Interface/Transmit Now! : check aprs.fi if a valid and accurate packet has been sent.
Check back with aprs.fi in 15 minutes to see if another packet has been sent.
Check Weather Underground to see if data is up to date.
I have endeavored to have my hamshack be 100% linux for a number of years. Licensed in 2001, my ham career really got going when I returned to the States in 2005. Upgrading to General and getting on HF, I integrated a computer into my operations. Ham Radio Deluxe was one of the most popular at the time and I used it – great for logging, digital modes, and rig control. When I had fun with APRS, I used UI-View, which was Windows based.
My first experience with linux was in the late 1990s. I had limited success. Not much later, Ubuntu gave me more of an opportunity to use linux for meeting my requirements for computing. I began to dip my toe in, using linux for rig control and logging. I switched to Mint around 2010-11. I found that Mint was easy to use and allowed me to use fldigi for digital modes, rig control, and logging. ARRL’s LOTW could also be used with linux and was integrated into fldigi. It was hard to find any aspect of the amateur radio hobby that required a computer and could not be done with linux.
Except, in my case, for one area of pursuit. APRS and my weather station. I had become a Davis Instruments fan since I got my first weather station in 2005. As mentioned before, UI-View handled the APRS portion and Davis had its own Windows-based software for handling the weather data the console produced. Back in 2011, the standard for linux-based APRS was Xastir. Xastir is a solid application and I had success using it to handle both internet and RF APRS traffic. But Xastir would not play well with the Davis Vantage Pro2. There was internet talk of a work around using a MySQL database. I had no luck. I kept my system on Windows, using UI-View for weather and APRS.
About two years ago, my Vantage Pro2, which I had since I was over in Iraq in 2007, finally died. The sensor package was mounted off my chimney when we first moved in to our current house over a decade ago. A great location for the weather station as it it high and clear of obstructions. Our roof, however, is steeply pitched and not something easy for me to traverse. I had gotten a TV antenna installation guy to install it – he did a great job. I think I had him back a few years later to swap out the battery. At one point, the board on the unit when bad and I replaced it. Then two years ago, one of our dogs shows up with an anemometer cup in her mouth. Perhaps a good sized chunk of hail had it the cup? Outside temperature data stopped working.
Rather than attempt to fix/repair the existing unit, it was time to replace. Over a decade is a long time to be exposed to the elements. I purchased a new Vantage Pro2 but then had a hard time finding someone to install. The local tv antenna guy took one look at my roof and said nope. A month ago we were getting our chimney inspected and cleaned and the gentleman was showing me pictures of the crown of the chimney. He’d just climbed up there. I asked if, for a reasonable fee, he’d be willing to swap out the weather station (and the VHF/UHF antenna). We struck a deal and now the weather station was operational again.
But could I still achieve my goal of a linux-based APRS/weather station? Enter weewx. This is an application that is like the Swiss army knife of weather station apps. I am not sure of what it does not do. The key aspect is that weewx produces a file (wxnow.txt) every minute using the same format used by APRS for weather data. Even better, the good folks at xastir created a script (wxnowsrv.pl) that copies the wxnow.txt information and pulls it into xastir. This was the solution!
And it works! Both weewx and xastir are happily working together on their own minimalist linux box, pulling in weather data from the Vantage Pro2 console via a serial connection while xastir is using a serial connection to transmit the weather data via my TM-D710A TNC functionality into the APRS system via RF. Weewx also creates a simple weather webpage which you can see here.
I kept a careful list of all the steps I completed in installing both weewx, MySQL, and xastir that I will post here soon – in case I need to reinstall. As of now the system seems to be stable and working nicely.