View unanswered posts | View active topics It is currently Fri Sep 10, 2010 7:30 am



Reply to topic  [ 91 posts ]  Go to page: Previous  1, 2, 3, 4, 5, 6, 7  Next
 NOAA Weather Script 
Author Message

Joined: Sep 07, 2005
Posts: 79
Location: NY
Post 
Not as of yet, still timing out with the same error code. Stopped & restarted the server just for kicks and I did reload attachments when I was trying different location codes (compiling & saving after each change). Reads as last updated July 26th 1:51 PM EDT. Thanks,

Ken


Tue Jul 29, 2008 12:48 pm
Profile

Joined: Sep 07, 2005
Posts: 79
Location: NY
Post 
Update, it's working again. I guess they were doing something on their end.

Ken


Fri Aug 01, 2008 11:21 am
Profile

Joined: May 07, 2008
Posts: 6
Post NOAA script error message
First off, I want to thank the author of this script for his work. It has allowed me to closely and efficiently control the climate in a plant nursery environment with Indigo and a couple of AppliancLincs, automatically running a fan or A/C or nothing depending on outside temperatures.

However, in the last few days, my Indigo server log has been returning the following error:

GetXMLfile:URL Access Scripting got an error: Connection is invalid.(-609)

Variables are still being updated by the script, although it does seem they do not update as often as they did before this error started occurring (I did modify the NOAA script to update every 20 minutes instead of every hour). As my coding abilities are just good enough to make me dangerous rather than useful, I thought I'd turn to the experts here. I'm guessing there's a problem with the scripting addition component, but I'm not sure where to start.

Ideas?

Cheers,
Tim


Fri Aug 01, 2008 2:18 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 2557
Location: Austin, Texas
Post 
As pointed out earlier in the thread, I suspect the server that the script is talking to has undergone some maintenance, so it's been up and down. It may also be that the API has changed slightly; however, I'm certainly no expert. I'd say let it run for another week or so to see if the errors disappear or continue.

I've turned my script on and will watch it as well to see if I seen any problems.

jay


Fri Aug 01, 2008 5:37 pm
Profile WWW

Joined: May 07, 2008
Posts: 6
Post 
Ah. I didn't quite grok that it was the same(ish) issue. I'll remain patient until word comes along.

Cheers.

jay wrote:As pointed out earlier in the thread, I suspect the server that the script is talking to has undergone some maintenance, so it's been up and down. It may also be that the API has changed slightly; however, I'm certainly no expert. I'd say let it run for another week or so to see if the errors disappear or continue.

I've turned my script on and will watch it as well to see if I seen any problems.

jay


Sun Aug 03, 2008 1:46 am
Profile
User avatar

Joined: Apr 10, 2006
Posts: 189
Location: Lower Hudson Valley
Post 
I just started using the script, thanks. I sometimes get the applescript -609 but not always. Using curl I see http code 301's (permanently moved).

The new url is: "http://www.weather.gov/xml/current_obs/" & NOAA_Station & ".xml"

And NOAA_Station needs to be all caps and is the 4 character ICAO LOC ID. Just prepend a K to the 3 character ID. jfk would become KJFK.


Fri Nov 07, 2008 1:40 pm
Profile

Joined: Feb 11, 2006
Posts: 20
Post Is the Weather tag new?
Hi Gang,

I love this script! Kudos! It works great on Indigo 3.

I was snooping through the XML file and found the "Weather" tag. I think I'm going to try to use this string to determine cloud density (for lighting) and precipitation (for sprinkling). There are only a finite set of options for this field, I just need to figure out what they all are. Also does anyone have any idea how to get a forecast XML? I'm thinking about using that to halt sprinkling if rain is due in the next few days.

Here is the XML NOAA is outputting:

<?xml version="1.0" encoding="ISO-8859-1"?>
<current_observation version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.weather.gov/xml/current_obs/current_observation.xsd">
<credit>NOAA's National Weather Service</credit>
<credit_URL>http://weather.gov/</credit_URL>
<image>
<url>http://weather.gov/images/xml_logo.gif</url>
<title>NOAA's National Weather Service</title>
<link>http://weather.gov</link>
</image>
<suggested_pickup>15 minutes after the hour</suggested_pickup>
<suggested_pickup_period>60</suggested_pickup_period>
<location>Chicago/Ohare, IL</location>
<station_id>KORD</station_id>
<latitude>41.98</latitude>
<longitude>-87.9</longitude>
<observation_time>Last Updated on Nov 16, 8:51 am CST</observation_time>
<observation_time_rfc822>Sun, 16 Nov 2008 08:51:00 -0600 CST</observation_time_rfc822>
<weather>Overcast</weather>
<temperature_string>30 F (-1 C)</temperature_string>
<temp_f>30</temp_f>
<temp_c>-1</temp_c>
<relative_humidity>75</relative_humidity>
<wind_string>From the West at 13 MPH</wind_string>
<wind_dir>West</wind_dir>
<wind_degrees>270</wind_degrees>
<wind_mph>12.65</wind_mph>
<wind_gust_mph>NA</wind_gust_mph>
<pressure_string>29.95&quot; (1014.8 mb)</pressure_string>
<pressure_mb>1014.8</pressure_mb>
<pressure_in>29.95</pressure_in>
<dewpoint_string>23 F (-5 C)</dewpoint_string>
<dewpoint_f>23</dewpoint_f>
<dewpoint_c>-5</dewpoint_c>
<heat_index_string>NA</heat_index_string>
<heat_index_f>NA</heat_index_f>
<heat_index_c>NA</heat_index_c>
<windchill_string>20 F (-7 C)</windchill_string>
<windchill_f>20</windchill_f>
<windchill_c>-7</windchill_c>
<visibility_mi>10.00</visibility_mi>
<icon_url_base>http://weather.gov/weather/images/fcicons/</icon_url_base>
<icon_url_name>ovc.jpg</icon_url_name>
<two_day_history_url>http://www.weather.gov/data/obhistory/KORD.html</two_day_history_url>
<ob_url>http://www.nws.noaa.gov/data/METAR/KORD.1.txt</ob_url>
<disclaimer_url>http://weather.gov/disclaimer.html</disclaimer_url>
<copyright_url>http://weather.gov/disclaimer.html</copyright_url>
<privacy_policy_url>http://weather.gov/notice.html</privacy_policy_url>
</current_observation>


Sun Nov 16, 2008 9:44 am
Profile

Joined: Mar 12, 2006
Posts: 24
Post 
Halting the sprinklers if rain is due is a great idea.

Just make sure to set a variable that you did so, for instance, "HALTEDSPRINTERSONDATE" would hold the value of the date they were halted on.

Then another applescript would clear that variable if/when it rained.

It could also ensure that if the variable still holds the date and the date is over three days old without being cleared, sprinklers would be re-enabled and the variable would be cleared cos obviously the weather ppl at NOAA were wrong. Sorry for going overboard but I am a computer programmer -- IF-THEN statements are my life. :D


Thu Nov 20, 2008 5:44 pm
Profile

Joined: May 14, 2008
Posts: 114
Post 
HOW DO YOU FIND YOUR LOCAL NOAA STATION I AM IN MISSOURI?


Tue Dec 09, 2008 7:59 pm
Profile WWW
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 2557
Location: Austin, Texas
Post 
I believe the URL is in the comments at the top of the script...

_________________
Jay (Indigo Support)
Image


Tue Dec 09, 2008 11:12 pm
Profile WWW

Joined: May 14, 2008
Posts: 114
Post 
Thanks discovered it right after I posted! :D


Wed Dec 10, 2008 7:07 am
Profile WWW

Joined: Dec 24, 2008
Posts: 3
Post speaking variables
Someone earlier asked how to speak the variables, and they went unanswered. Well I just figured it out:

Action Group -> Type: Execute AppleScript -> Embedded

say "Goodmorning Master. The weather outside iz; " & ((value of variable "Weather_Condition") as string) & " , " & ((value of variable "Weather_Temperature_F") as string) & " degrees fare enhite"


The mis-spellings are to get the computer to pronounce them better.


Wed Dec 24, 2008 1:12 am
Profile

Joined: May 27, 2007
Posts: 551
Location: NC
Post 
I'm not getting the correct info across.

Temps are WAY low; -1F when its 56F outside. (C is as off too) Also getting info from about an hour earlier .

I verified via NOAAs web site (did a cut-n-paste from the script for the station, so station is correct)


Thu Dec 25, 2008 8:13 am
Profile
User avatar

Joined: Nov 18, 2008
Posts: 705
Location: Berkeley, CA
Post Need help Hacking NOAA script to support nested xml tags
Note: I originally posted this as a New Topic a couple of weeks ago, but got no replies. Since it looks like more people follow this thread, I thought I'd give it one more try here.

I am not really an Applescript coder, but I have taken a stab at hacking the NOAA script (thanks Karl and Matt) to use for the Weather Underground. I wanted to use the Wunderground mostly because of the their support for personal weather stations (PWS) because there are several PWSs close to my home.

In general, the script works, as the two dtds are similar. However, I do have one problem with the Wunderground format that I can't resolve. They use some nested tags. For example:
Code: Select all
...
<location>
<full>Ardmore @ Coventry, Kensington, CA</full>
<neighborhood>Ardmore @ Coventry</neighborhood>
<city>Kensington</city>
<state>CA</state>
<zip></zip>
<latitude>37.903099</latitude>
<longitude>-122.279701</longitude>
<elevation>460 ft</elevation>
</location>
...

The NOAA script assumes that all tags are on the same level (elem1).
Code: Select all
tell application "System Events"
   set elem1 to XML element 1 of XML file myFile
   set observation_time to value of XML elements of elem1 whose name is "observation_time"
   set location to value of XML elements of elem1 whose name is "location"
   set station_id to value of XML elements of elem1 whose name is "station_id"
   ...

I cannot figure out how to reference the tags nested inside the <location>...</location> tags using System Events. I have googled for some reference help, but what I can find is very abstract and not much help.

Any ideas would be appreciated, and I will make the finished script available for the Contributions library.

BTW, one other oddity, if a variable is unset, in the xml data
Code: Select all
<windchill_string></windchill_string>

and the applescript tries to send it to Indigo, the script throws an error:
Code: Select all
SendToIndigo:IndigoServer got an error: A descriptor type mismatch occurred.(-10001)


This does not happen with the NOAA script because NOAA seems to be pretty good about inserting some value, even NA for all tags. Any ideas on how to properly treat a null value tag?

Thanks,

Richard


Tue Feb 10, 2009 12:09 pm
Profile

Joined: Jul 20, 2008
Posts: 41
Post 
I would love a Weather Underground version too!! Just not sure I'd be much help getting a script going... :(


Tue Feb 10, 2009 12:29 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 91 posts ]  Go to page: Previous  1, 2, 3, 4, 5, 6, 7  Next

Who is online

Users browsing this forum: MSN [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.