Weather station reporting

I recently put my AcuRite weather station back up after having it sitting in the garage for a year or so.  I have the Internet Bridge, which recently got a firmware update, and wanted to have it reporting to both AcuRite and Weather Underground.

AcuRite’s site will apparently update WU, but only at 15 minute intervals.  And, I wanted to also collect the data locally so I can feed it into Splunk or some other tool for my own use.

Problem is, the AcuRite gateway box only sends data (via HTTP GET) to one fixed hostname that’s hard coded, hubapi.myacurite.com.  SO…  first we intercept those DNS calls to send them where we want them.  In named.conf:

acl wxbridge-only {
        ip.of.wx.bridge/32;
};

view "wxbridge-view" {
        match-clients { wxbridge-only; };
        zone "hubapi.myacurite.com" {
                type master;
                file "hubapi.myacurite.com";
        };
};

And the zone file:

$TTL 14400
@               IN      SOA     localhost. dale.botkin.org. (
                                2016081803
                                3600
                                3600
                                604800
                                14400 )

@               IN      NS      localhost.

hubapi.myacurite.com.   IN      A       ip.of.local.server;

Now the weather bridge, and ONLY the weather bridge, gets your local machine’s IP address for hubapi.myacurite.com.  So next we create a PHP script and use Apache to point /weatherstation to it (ScriptAlias /weatherstation /var/www/cgi-bin/updateweatherstation.php in my case).  The script sends the original HTTP request to hubapi.myacurite.com, then reformats it and sends it to wunderground.com.  It’s also preserved in the Apache access log, so you can ingest it into Splunk.  You could also syslog it or write it to a file, whatever you want.  I started out using a script I found that Pat O’Brien had written, but ended up rewriting it almost entirely.  It’s been years since I wrote a PHP script.

<?php
 // First send it to AcuRite, no massaging needed...
 $acurite = file_get_contents("http://hubapi.myacurite.com/weatherstation/updateweatherstation?" . $_SERVER['QUERY_STRING']);
 echo $acurite;
 // Now re-format for wunderground.com. We don't always
 // get every parameter, so only send those we do get and
 // strip out those that wunderground won't accept.
 $msg = "";
 $winddir = (isset($_GET['winddir']) ? "&winddir=".$_GET['winddir'] : null);
 $windspeedmph = (isset($_GET['windspeedmph']) ? "&windspeedmph=".$_GET['windspeedmph'] : null);
 $humidity = (isset($_GET['humidity']) ? "&humidity=".$_GET['humidity'] : null);
 $tempf = (isset($_GET['tempf']) ? "&tempf=".$_GET['tempf'] : null);
 $rainin = (isset($_GET['rainin']) ? "&rainin=".$_GET['rainin'] : null);
 $dailyrainin = (isset($_GET['dailyrainin']) ? "&dailyrainin=".$_GET['dailyrainin'] : null);
 $baromin = (isset($_GET['baromin']) ? "&baromin=".$_GET['baromin'] : null);
 $dewptf = (isset($_GET['dewptf']) ? "&dewpointf=".$_GET['dewptf'] : null);
 $msg .= "dateutc=now";
 $msg .= "&action=updateraw";
 $msg .= "&ID=<your weather station ID here>";
 $msg .= "&PASSWORD=<your weather station password here>";
 $msg .= $winddir;
 $msg .= $windspeedmph;
 $msg .= $humidity;
 $msg .= $tempf;
 $msg .= $rainin;
 $msg .= $dailyrainin;
 $msg .= $baromin;
 $msg .= $dewptf;
 $msg .= PHP_EOL;
 $wunderground = file_get_contents("http://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?".$msg);
 // Let's log any failures with the original message, what we sent,
 // and the response we got:
 if(trim($wunderground) !=  "success" ) {
 openlog('weatherupdate', LOG_NDELAY, LOG_USER);
 syslog(LOG_NOTICE, $_SERVER['QUERY_STRING']);
 syslog(LOG_NOTICE, $msg);
 syslog(LOG_NOTICE, $wunderground);
 }
?>

So far it’s been working fine for a couple of days. I have noticed that the AcuRite 5-in-one station will go for extended periods without sending some data – it seems like it only sends what has changed, or what has changed with seemingly random pieces of information.  For example, it may send the barometric pressure even if it hasn’t changed, but not the temperature or wind direction if they’re stable.  It’s weird.  Of course now I understand why they only send periodic updates to Weather Underground.  AcuRite’s own site seems to mask this behavior, but Weather Underground does not.  I’m thinking about keeping a persistent state file and sending every parameter with every update, or collecting updates and just sending WU a digest every minute or two.  But that’s a project for another day.

 

Winter flight training

Well, I thought doing my primary training in the winter would be a good idea.  Colder air means lower density altitude (more lift, shorter takeoff runs), not as many student pilots since school is in session, and not as much sweat in the cockpit.  Well, not from heat anyway…  stress still does its job.  The problem so far has been extremely variable weather.  One day it’s “severe clear”, not a cloud in the sky and visibility almost unlimited.  The next (like today) it’s low ceilings, snow, wind, temps below 10 degrees or some combination.

It looks like tomorrow is supposed to be a good clear day after today’s snow.  I’m going to try for a lesson tomorrow, and talk to my CFI about how much notice he wants.  Yesterday would have been a perfect day for flying, but I didn’t want to call him at noon on Sunday and say, “Hey, let’s go fly – right now”.  If I find out he’s OK with that, though, I’m not going to hesitate in the future.  At any rate I’ll get done what I can, when I can.  Waiting for summer isn’t really an option I’m willing to go with.  I’ve had two false starts, I don’t want to bump that number up again.

Cell phone troubles

Well, the other day I pulled my 14 month old Droid 2 Global from my pocket, and found it powered off.  That’s unusual.  What was worse, it wouldn’t boot — I got a text bootloader screen telling me the battery was too low to load code.  Not good.  Figuring the battery had croaked, I ordered a new one ($3 or so eBay special).  Unfortunately, it seems the problem runs deeper.  The phone won’t charge the battery regardless of how I try it, and the new battery didn’t last long enough to load a firmware image from my PC.  I believe the phone is now expensive scrap.

So off to the Verizon store I went. I’ll spare the details, but suffice it to say that I left there, as usual, with no working phone and a serious intent to just cancel ALL our Verizon service.  Seriously, where do they find these worthless little retards?  A call to their customer service line was a complete waste of time…  I ended up finding out that their phone reps have to use a web site that sucks even worse than the consumer site (quite a tall order) and it’s actually cheaper to just use the web site.  Sigh…

After wasting most of a day on this — well, more than a day, since I’d spent several hours on it before today — I have a new Droid 3 on the way, at zero cost, with a vehicle mount and the desk charging dock.  I just had to go somewhere other than Verizon.  I found a place on eBay with a killer upgrade deal, did a little research, found out they were legitimate and that, in fact, even NewEgg uses them.  So I went through NewEgg, since I have more confidence in their ability and willingness to strong-arm a vendor if they don’t deliver.

Now, why I have to jump through so many hoops and do so much work for the exact same end result is beyond me.  In the end I get a brand new Verizon phone, and a new extension of my existing Verizon service.  Just like if I’d done it in 10 minutes at the Verizon store.  The only difference is that NewEgg and the company they use are both making money — and Verizon isn’t.  In fact, as far as I can tell Verizon is making a few hundred dollars less than if they’d just sold me the phone in the first place.  It’s beyond stupid.

In the end I get a new phone, but I’m about 50% less satisfied with VZW than I was before.  So much so, in fact, that I plan to see if I can get my phone to work on AT&T and T-Mobile networks (there is a way) so I can try out prepaid SIM cards from them and see if they suck less.  Maybe, maybe not…  but VZW has really gotten to be a pain in the ass to deal with.

On top of all this,  we were supposed to fly today but it’s too damn cold.  Oh well.

44 days to go!

Snow all you want, the wind can blow, I don’t care.  In a little under a month and a half, I’ll be laying on the deck of a Carnival cruise ship sipping a rum punch and starting work on my sunburn.  Take that, winter!

🙂

A little bit of early snow

We got a little surprise yesterday morning.  Fortunately the roads to Hastings were clear, so we were able to get out to Pete’s game without any problems.  Unfortunately, they lost to Morningside.  The Broncos are now 5-2, with their two toughest opponents behind them.

A shot of the back yard
A shot of the back yard
This one shows how deep it was...
This one shows how deep it was...

By the time we got home last night most of the snow was already gone.  We still have some hanging on in the back and side yards where it’s well shaded, but the rest is dry.

Hopefully it will get warm enough today that I’ll be able to get the sprinklers blown out.  Temperatures are supposed to be in the 40s for the next several days, with no freezing lows, but of course you never know for sure.