Share your Tips & Examples This forum is for posting your Tips, Examples or sample programs. Please post here and the staff will review the post, and share it in the proper forum upon approval.

Reply
 
Thread Tools Display Modes
Old Nov 16, 2011, 09:49 AM   [Permalink]  #1
kwilcox
HCA User
 
Join Date: Nov 2009
Location: Wisconsin
Posts: 29
Rep Power: 4 kwilcox is on a distinguished road
Default Using Weather Underground data in HCA.

I've developed a powershell script and a template file that let's me pull weather data from a nearby weather underground station and load it in to HCA as weatherlink data! What's cool about the script is that it actually makes a HTTP request to the local Weather Underground station and pulls the comma delimited historical data page down. This file contains weather data taken in 5 minute intervals. It then parses the file and creates a file named "weatherdata.htm" in a folder named c:\hcaweather containing the most recent observation. If you place the attached weatherdata.htx template file in the same folder, then you can light up HCA in weatherlink provider mode!

Here's how to use it. First, replace the Station ID in the powershell http call with the Weather Underground Station ID that you want. Generally, you can find local Weather Underground stations by simply Googling for "<your community name> Weather" then following the weather underground link in the returned results. Go to the bottom of that page and you will find the Weather Stations that are being used. You will be amazed at how close these stations generally are to you! Clicking on any of those will send you to that station's historical data page where the Station ID will be prominently displayed. At the bottom of the "Tabular Data" section, there's a small link called "comma delimited file". This is what the powershell script will be retrieving. Click on that and make sure that the powershell URL matches you browser's URL. It's also a good idea to double check to see that the weather tags in the attached template file match up with the column names. Some template tweaking may be required here.

Here's a link to a complete list of weatherlink html tags that can help you match everything up if necessary:

Weatherlink HTML Tags

Now, simply set up HCA to make 15 minute observations and set up your HCA server to run the powershell script as a scheduled task every 15 minutes.

note: If you haven't used powershell before, you will have to change your security settings to allow unsigned scripts to be run locally. Do this by running powershell then entering the following command:

set-executionpolicy remotesigned

Enjoy!
Attached Files:
File Type: zip HCA Weather Underground.zip (833 Bytes, 255 views)
kwilcox is offline   Reply With Quote
Old Nov 23, 2011, 10:29 AM   [Permalink]  #2
kwilcox
HCA User
 
Join Date: Nov 2009
Location: Wisconsin
Posts: 29
Rep Power: 4 kwilcox is on a distinguished road
Default Re: Using Weather Underground data in HCA.

Just to show some of the cool stuff you can do with this info, here's an html display I made using the weather data:



I'm pulling cloud cover data from the METAR station in Milwaukee, and detailed ovservational data from a weather underground station that's about 2 blocks away.

I'm using the HCA status export element to output all of this to an ASP document that is subsequently rendered by a local server (fttb, I'm borrowing AccuWeather icons while I build up my own set). Getting it to work was a bit of a puzzler since server-side vbscript is enclosed by "<%" and "%>" and "%" is also the HCA "evaluate expression" delimiter. To solve it I had to use "<%_chr(37)%" and "%_chr(37)%>" to produce the required ASP delimiters...

Very cool stuff. Now if only the Android Client would get enhanced to use HTML displays...

Last edited by kwilcox; Nov 23, 2011 at 11:34 AM.
kwilcox is offline   Reply With Quote
Old Mar 11, 2012, 09:57 PM   [Permalink]  #3
kilo
New Member
 
Join Date: Mar 2012
Posts: 4
Rep Power: 0 kilo is on a distinguished road
Default Re: Using Weather Underground data in HCA.

Ok I have a couple of questions about your scripts.
First, what calls on the script to run, HCA?
Second, what do you mean by my browers url?
and third, whats the setup procedure in HCA to run this script?

Thanks for the info and help
Im new to HCA so please bare with me....LOL

Thanks again

Kilo
kilo is offline   Reply With Quote
Old Mar 14, 2012, 09:55 PM   [Permalink]  #4
pierrelab
New Member
 
Join Date: Jan 2011
Posts: 3
Rep Power: 0 pierrelab is on a distinguished road
Default Re: Using Weather Underground data in HCA.

Very nice work... I'm using it to trigger heating and cooling, conditional watering and just planning many more ideas..

Thank you for sharing.
pierrelab is offline   Reply With Quote
Old Apr 25, 2012, 11:23 PM   [Permalink]  #5
kwilcox
HCA User
 
Join Date: Nov 2009
Location: Wisconsin
Posts: 29
Rep Power: 4 kwilcox is on a distinguished road
Default Re: Using Weather Underground data in HCA.

Originally Posted by kilo View Post
Ok I have a couple of questions about your scripts.
First, what calls on the script to run, HCA?
Second, what do you mean by my browers url?
and third, whats the setup procedure in HCA to run this script?

Thanks for the info and help
Im new to HCA so please bare with me....LOL

Thanks again

Kilo
HCA runs the script out of a program using the "execute script" program element. You will need to set up HCA to run powershell scripts with that element. The settings you need to work with are in visual programs->script setup. In script engine, change the application to be powershell.exe (make sure you specify the full path to it), and add -File to command line parameters. In Script editor change the file extension to vbs.

I actually run the program that contains the execute script element from the weather observation which updates the website. Set this in weather provider properties->observation frequency.

URL or "universal record locator" is a web address. ie "http://mywebsite.com"
kwilcox is offline   Reply With Quote
Old Jun 03, 2012, 05:30 PM   [Permalink]  #6
GuyBooth
HCA User
 
Join Date: Mar 2012
Location: Toronto, Canada
Posts: 13
Rep Power: 0 GuyBooth is on a distinguished road
Default Re: Using Weather Underground data in HCA.

So I followed your instructions and was able to get as far as having the weather station reporting, the htm file created, and the data transferred to the dbf file. However, the data is not in the same order (for instance the "Barometer" readings are shoing up in the "Windspeed" column. The data matches the Tags (for the most part - I can deal with that one later) but how do I get the data to fall into the right columns?
Thanks for your help on this.

(Added later) OK I think I've got that working! My only problem now is that I can get HCA to recognize everything I want EXCEPT anything to do with rainfall. I'm looking for Rain Rate, but every expression I use comes up with 0 or ---.

Guy

Last edited by GuyBooth; Jun 04, 2012 at 03:36 PM.
GuyBooth is offline   Reply With Quote
Old Jun 18, 2012, 08:42 PM   [Permalink]  #7
kwilcox
HCA User
 
Join Date: Nov 2009
Location: Wisconsin
Posts: 29
Rep Power: 4 kwilcox is on a distinguished road
Default Re: Using Weather Underground data in HCA.

rainrate works for me. A lot of weather underground stations don't publish rainfall though. You'll have to page through your local wunderground sites on a rainy day and use one that show rainfall data.
kwilcox is offline   Reply With Quote
Old Jun 27, 2012, 05:23 PM   [Permalink]  #8
GuyBooth
HCA User
 
Join Date: Mar 2012
Location: Toronto, Canada
Posts: 13
Rep Power: 0 GuyBooth is on a distinguished road
Default Re: Using Weather Underground data in HCA.

I did get it working ... it is confusing that in the database file, the "Rain" column is actually for rain accumulated over a 24 hour period starting at 6:00 am. But HCA reads Rain Rate directly from the HTM file generated by the script.
I have seen a couple of occasions now when the Weather Station I am downloading from is not generating data for a while, so it was a little hard to track down.
GuyBooth is offline   Reply With Quote
Old Apr 10, 2013, 03:24 PM   [Permalink]  #9
smokey
New Member
 
Join Date: Jul 2008
Location: Waverly, Va
Age: 66
Posts: 2
Rep Power: 0 smokey
Default Re: Using Weather Underground data in HCA.

Is there a way to get historical data from this?
I like being to get weather only a couple of blocks from my house, this is greate.
smokey
smokey is offline   Reply With Quote
Old Apr 10, 2013, 10:11 PM   [Permalink]  #10
kwilcox
HCA User
 
Join Date: Nov 2009
Location: Wisconsin
Posts: 29
Rep Power: 4 kwilcox is on a distinguished road
Default Re: Using Weather Underground data in HCA.

HCA does maintain observation history in its own database.
kwilcox is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HCA and Arexx Temperature logger system: how to connect data? FWilde Text Scripts 0 Sep 02, 2011 04:42 AM
Weather Software's support variables rdunaway62 HCA Discussions 3 Nov 16, 2010 11:40 PM
Using Weather Forecasts friedmanwd HCA Discussions 2 Sep 09, 2010 03:24 PM
How to work with weather data HCA Admin Technical Notes 0 Sep 01, 2009 12:22 PM


All times are GMT -4. The time now is 08:37 AM.