Home Automation,  Mac OS X,  Minneapolis,  sites

Control the Weather Using Curl

Wait, did I say control, I meant query… Sorry to disappoint!

I am a home automation nerd. Recently I’ve noticed that as it gets closer to warmer or cooler extremes that it takes longer for my hvac system to bring my house to the temperature I want. I’ve also noticed that NEST claims to automatically learn these factors. Not to be outdone by the Griswolds, I decided to look at building this into my system.

I had been experimenting with using the weather.com site to pull this data but then someone pointed out that NOAA (the National Oceanic and Atmospheric Administration) actually publishes this information on their site. I was able to access a simple-to-parse dump of information for the Minneapolis airport, which is pretty close to my house. The URLs are based on ICAO codes. You can find the code for your airport on the ICAO code wikipedia page. The URL to look at for information is http://weather.noaa.gov/pub/data/observations/metar/decoded/.TXT or http://weather.noaa.gov/pub/data/observations/metar/decoded/KMSP.TXT for Minneapolis (or http://weather.noaa.gov/pub/data/observations/metar/decoded/KANE.TXT for Blaine which is actually closer to me). You can actually just curl this straight with nothing special to view the text file:

curl http://weather.noaa.gov/pub/data/observations/metar/decoded/KMSP.TXT

The output is basically as follows:

MINNEAPOLIS-ST PAUL INTERNATIONAL , MN, United States (KMSP) 44-52N 93-13W 265M
Oct 01, 2013 - 10:53 AM EDT / 2013.10.01 1453 UTC
Wind: from the WNW (290 degrees) at 13 MPH (11 KT) gusting to 24 MPH (21 KT):0
Visibility: 10 mile(s):0
Sky conditions: mostly clear
Temperature: 68.0 F (20.0 C)
Dew Point: 48.9 F (9.4 C)
Relative Humidity: 50%
Pressure (altimeter): 29.82 in. Hg (1009 hPa)
Pressure tendency: 0.14 inches (4.6 hPa) higher than three hours ago
ob: KMSP 011453Z 29011G21KT 10SM FEW150 20/09 A2982 RMK AO2 SLP094 T02000094 51046
cycle: 15

I subtracted or added the difference in temperature to my desired temperature and am experimenting with how much more quickly I need to fire things up based on that (for my hvac system seems to be about a minute per 10 degrees of delta), but there are definitely plenty of ways to go about such number nerdery. Either way, I can now control the temperature based on the weather using curl, which is basically controlling the weather in my house, so not as untrue a title as with most front-page newspaper articles…

Finally, there’s also a REST API, available from NOAA at http://graphical.weather.gov/xml/rest.php.