Another One Bites the Dust

I use Nagios software to monitor my home network, including the hardware and software services. When there is an issue with anything being monitored Nagios sends me an email alert. I recently received an alert that the computer (Raspberry Pi 1B) that runs my weather station was offline. I checked and the computer was powered up but was not reachable on the network. I rebooted the computer and it came back online, but all of the software services that run on that computer were not running.

I attempted several times to reboot the computer and connect to it over the network with no success. I use an external hard drive with that Raspberry Pi and it appeared that the Raspberry Pi would start to boot from the SD card and then fail when it attempted to access the external drive. I removed the drive and connected it to another Raspberry Pi and ran “fsck” on the drive. When I saw the number of errors that scrolled across the screen I knew the drive was badly corrupted. In the end there were no files left on the drive and everything that could be salvaged was in the lost+found directory.

While the fsck command was running I decided to reimage the SD card that boots the computer. This was because I needed to update to the most recent version of Raspbian and thought this was a good time since I was going to have to create a new bootable hard drive. I booted the Pi from the SD card and it came back to life. I connected another external drive to the PI and it was not recognized. I attempted replacing the drive with several other external drives with the same result. All of the external drives worked with another Raspberry Pi I had so the drives weren’t the main problem.

In the end I connected the Davis Vantage Vue console to another (and slightly newer) Raspberry Pi that was already up and running. I took all of the weather station software and data files I had salvaged using fsck and installed them on that computer. Then I brought the weather station service online on the new host computer. This is most likely a temporary solution but for now everything is operational again.

Satellite Images (Again)

Once again satellite images were not showing up on my satellite page. I did some quick research and found a new set of links to the satellite images. I believed that I was using an approved API to get the images, but apparently I was mistaken. Either that or the API was changed or removed. So now the satellite images are working again. I’ll just have to keep chasing them around the NOAA site or else find a different source for them.

Upgrade to SSL

My Web hosting provider has added an SSL certificate to my web hosting plan. This certificate permits me to use SSL encryption on all my web pages. If you don’t know what that means, I can now use the encrypted https protocol rather than unencrypted http. In the past there was a performance penalty for using SSL, but nowadays this penalty is minimal and it is generally recommended to use SSL wherever possible. Without a certificate I was unable to use SSL encryption on my web site. But with the addition of the certificate to my account I was able to make the switch.

The first thing I did was to check using my browser to see if all the pages loaded when I typed https://www.cloppermillweather.org. All my pages loaded, but none of the images were showing. When I switched back to the unencrypted protocol everything loaded fine. After a lot of head scratching and a bit of searching I learned that my web site had a feature called Hotlink protection turned on. What Hotlink does is prevent other web sites from linking directly to resources on your web site.This prevents the other site from using your images in their web pages and in effect stealing your bandwidth. I don’t recall turning on this feature for my web site so I’m guessing it was on by default. It blocks all links to images except for sites with an exception set in the software. The problem is that there was only an exception for my unencrypted web site. I added an exception for the encrypted site and the images were now visible.

The next change I wanted to make was to redirect requests from the unencrypted site to the encrypted one. This would force anybody connecting to my site using http to be automatically switched to https. I added the following lines to the .htaccess file for my site and now all the http requests changed to https.

# redirect to ssl page if request is for the non-SSL page
RewriteCond %{HTTPS} off
# Redirect to HTTPS
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I made these changes to all my web sites hosted with this provider, and as far as I can tell they all are working fine. I haven’t done any concrete measuring, but I am unable to observe a performance penalty. I’ll consider this a success so far.

Missed Rain Event

On July 8 2018 we had an historic rain event that triggered flash flooding and water rescues all over the area. I was excited to see what my rain gauge had recorded, and as soon as I had an opportunity I checked my web site. I was shocked to see that no rainfall had been recorded that day. I checked the console for the Vantage Vue and it also read no rainfall that day., We had some rain a couple of days earlier and that had registered, but nothing for the big event that was still occurring as I checked.

This obviously upset me, and I went out in the rain to check my weather station. I assumed that something was blocking the gauge and preventing the water from entering it. When I went outside to look, I saw that nothing was blocking the gauge and that the rain was entering and exiting the gauge normally. At this point the only thing I could think of was to take down the weather station and attempt to service it in my dry garage.

Once I got the gauge down from its’ pole and into the garage I started inspecting it. I learned (and should have remembered) that the rain and temperature sensors were designed to be easily removed and cleaned. I removed both of those sensors and gave them a good cleaning. I didn’t find anything clogging the rain gauge but I cleaned it out anyway. Then I reassembled the station and reinstalled it on the pole.

When I went back inside and checked the weather station console it said it was not receiving the weather station at all. I was unable to get the station and console to pair, so I took the station back inside to try and pair them up in a place where it was nice and dry. I eventually got them paired back up and reinstalled the weather station back on its’ pole for hopefully the last time.

Going back inside and looking at the console I saw rain being recorded once again. Success finally.I The moral to the story is that I need to do regular maintenance on the weather station. Davis designed it to make it easy to clean. I just hadn’t done it for a long time. I’m going to add a reminder to my calendar to clean out the gauges annually at a minimum.

PHP 7.2 Upgrade

A few days ago my Web hosting provider upgraded the server hosting my web site to PHP version 7.2. I haven’t made any attempts at running my web site under anything newer than PHP 5.6. At least not until now. Most of the site still worked fine. The only page that failed is the advisories page that displays the NWS discussion of the current weather conditions. I was using some functionality that has been deprecated and no longer works in PHP 7.2.

I made some updates that wouldn’t have been difficult if I had kept my limited PHP development skills up to date. Once I had refreshed myself on the PHP side of my code the updates weren’t very difficult. I needed to replace a few preg_replace calls with the newer preg_replace_callback. Once that was completed the site worked again.

I have uploaded the updated code to the site. This may also serve to motivate me to update some of my supporting jar files since the versions on them are likely quite old. That’s what I get for not keeping my software up to date.

Satellite Images

Today I noticed that none of my satellite images were showing.  I’m not certain how long this was broken.  NASA had changed their naming conventions on the GOES images.  Fortunately they provided an API to permit embedding the images on web pages.  I modified my satellite page to use the API.  I also added some images from the National Hurricane Center.  I may still make some changes to the images page to make it more customizable.  But for now it is fixed.  I will upload the updated source code for anybody that might be interested.

Problems With Temperature Below Zero

We experienced a cold spell where temperatures fell below zero degrees Fahrenheit.  Unfortunately my scheme for decoding the Davis Vantage Vue data didn’t handle negative numbers properly.  I did some quick research and found that Java offers a class called a ByteBuffer that could handle the conversion and also handle any endian issues that might occur with the conversion.  I made a quick change in the code and everything appears to be working OK.  The true test will be when the temperature drops down below zero again.

Raspberry Pi and Davis up and Running Again

It took me a few days, but I finally relocated my Raspberry Pi and set up the revised weather station software.  Everything appears to be working just fine.  I plan to just let things run as they are for now and see what develops.  Hopefully the weather station is all set for the winter.  I also need to post the updated software to my Web site in case somebody plans to use it.  I’ll revise this post once it has been uploaded.

Hardware Failure

Well, I sort of predicted there would be some kind of hardware failure in my future.  The predicted failure finally occurred.  After some diagnosis it looked like my 1-wire hub failed.  Also, my barometer became intermittent, occasionally returning a reading of zero.  Some research proved hat the hub was no longer available, and support for 1-wire in general wasn’t very good anymore.  Hobby Boards, which was the source of most of my hardware was even preparing to go out of business.  It was becoming clear to me that 1-wire was probably not the best choice to purchase as new hardware.

After some investigating, I decided that my best choice was a Davis weather station, either the Vantage Pro or Vantage Vue.  They both are solar powered and wireless, which was a big step up from my previous weather station.  The Pro would be my preference, but cost drove me to the Vue.  The two features I wish the Vue had are a fan aspirated solar shield and the ability to separate the anemometer from the rest of the station for better siting.  But when I looked at the cost I realized that my current station has all the sensors mounted together, even though I could separate them.  And I could figure out a way to add a fan if solar heating became an issue.  So I placed my order for a Vantage Vue and the Weatherlink hardware/software.

Once the new hardware arrived, I set it up indoors for testing.  After I verified that it was working I mounted the hardware sensors outside and made sure the console was receiving a good signal.  I had no issues and everything worked perfectly.  Then I installed the Weatherlink module and connected it to my computer in order to test that interface and modify my weather software to work with the Davis hardware.  After a bit of experimentation and reading the Davis documentation I got the software talking to the Weatherlink module.

At the moment the revised software is running in my development environment, which is a Windows 10 desktop computer.  I plan to migrate everything back to the Raspberry Pi in the next few days.  Since the Pi isn’t running my weather station software at the moment I took this opportunity to use apt-get to upgrade any software running on the Pi.  It hadn’t been upgraded, powered down, or rebooted in well over a year, so it was long overdue.  I plan to relocate the Pi to another room in my house, so it will take me some time to make room for everything.  I hope to have everything running back on the Pi within the next few days.

User Agent

I noticed yesterday that the weather forecast on my Web site was almost 24 hours out of date.  I looked through my log files and saw that I was getting a 403 error which means access denied or a permissions problem.  When I browsed to the same pages using a browser I was able to access them just fine.  I was also able to use wget to retrieve the pages. I decided it might be a problem where PHP was not sending a user agent header and the NWS Web server was looking for one.  I added a user agent header to all of my pages that retrieve weather data from the NWS and everything is back up and running again.

I’ve also noticed, but nor done anything about two of my other pages,  The RSS feeds I was using for local alerts and traffic information no longer operate as the feeds have been discontinued.  I put a message on the pages and will need to search for a new source of traffic and alert information.

Other than that the station has been running on auto-pilot for quite a few months now.,  I’m probably overdue for some type of hardware failure but I’m keeping my fingers crossed.