Zabaware Support Forums

Zabaware Forums => Ultra Hal Assistant File Sharing Area => Topic started by: Spitfire2600 on October 30, 2016, 04:10:40 am

Title: Weather Alert V5
Post by: Spitfire2600 on October 30, 2016, 04:10:40 am
I have rewritten the plug in for HAL obtaining specific weather data.

It was originally written by Bill DeWitt however, I found it a bit dated and also sometimes the website where the information is received is a bit buggy sometimes. So, this rewritten code should fix those issues.

Current weather retrieval functions include current Weather, Humidity, Temperature, Wind Speeds, Wind Chill, and Visibility. A couple of other things I included in the code is the ability for Hal upon greeting to warn the user of dangerous temperatures, if any. (for now only temperature. Soon I'll include damaging winds and weather conditions)

Hope everyone finds it useful, please feel free to modify and share.

-Spitfire

PS. I have a slew of other plug-ins I'm currently writing, including a very stripped down version of ConceptNet for Hal, an advanced auto-learning suite of plug-ins including rewritten vrFreewill, Markov, and GrettaResearch, and few scripts to allow Hal the ability to research the internet on his own and log weather, learn from news, etc. Also I have an updated version of my SmartAlarm. I want to get this all out before Robert changes HALS programming languages on me. lol     
Title: Re: Weather Alert V5
Post by: Art on October 30, 2016, 07:46:12 am
I was thinking about pretty much the same thing. Maybe the Improved Hal will allow for the same plug-ins to be used (can we say, "backward compatible"?)...I thought you could.;)

Keep on truckin' as I'm sure your rewrites will get some good mileage one way or the other.  ;)

Title: Re: Weather Alert V5
Post by: doggs on October 31, 2016, 07:53:51 am
cool
Title: Re: Weather Alert V5
Post by: DayWalker on November 05, 2016, 07:27:51 pm
I would like to thank you guys for all your hard work to Hal.
Title: Re: Weather Alert V5
Post by: DayWalker on November 06, 2016, 04:35:35 pm
Works GREAT but one little problem. Hal is not giving me the right weather for the zip code where I live. I was looking at the code to see where I could edit it and add my zip code but I don't see it anywhere. Could you help in this matter?
Thank you
Title: Re: Weather Alert V5
Post by: Art on November 07, 2016, 07:49:56 am
The problem is that you are seeing weather conditions for Lima, Ohio and not where you live.

To work around this open the Weather5.uhp program (Use a regular text editor or a nice FREE one like Notepad++)

Look around line 82 and you should see: objXMLDoc.load("http://w1.weather.gov/xml/current_obs/KAOH.xml")

Notice the KAOH near the end. This is the Callsign that serves to identify that particular location.

In order to figure out the proper Callsign for your location go to this site: http://www.nws.noaa.gov/nwr/coverage/county_coverage.html (http://www.nws.noaa.gov/nwr/coverage/county_coverage.html)

Once there you should find your State, then the nearest City. Notice the Callsign (usually Four letters).

Remember or jot the letters down.

Insert those letters in place of the KAOH in the following lines (give or take a few numbers as different editors might count lines a bit differently).
So you should be at or near the following lines that need to be changed:

82
128
231
263
330
356
382

Once you've made the substitutions / changes, be sure to save your weather5.uhp file (it does need to be kept in the Ultra Hal Assistant 6 or Ultra Hal 7 folder).

Restart Hal, make sure that the weather plugin is selected then try the Check the weather command again. Ask, "Show current weather conditions, etc."

Good luck, hope this helps.

Title: Re: Weather Alert V5
Post by: DayWalker on November 07, 2016, 07:14:56 pm
Thank you for your help. Have a good evening.
Title: Re: Weather Alert V5
Post by: DayWalker on November 08, 2016, 09:22:47 pm
You know I was thinking. Could or is there a way for you to add these two things to your code.

1.) Sun rise and Sun set
2.)Moon rise and Moon set

I think that would be so cool to also have these two things added.
Title: Re: Weather Alert V5
Post by: DayWalker on November 08, 2016, 09:29:03 pm
One more thing Your code works GREAT, I was able to change my Call sign and the plugin runs. But I am getting this once Hal is done telling me the weather conditions...

Server Error in '/' Application.
The resource cannot be found.
  Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.
Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491

One moment.
News feed complete. Closing uplink.

Now I don't know why it is doing this but maybe it is because I also have working the "GRETTA News and Weather Feed" and there is a conflict.
Title: Re: Weather Alert V5
Post by: DayWalker on November 08, 2016, 09:31:46 pm
Yes I can confirm that there is a conflict between your Weather Alert v5 and the "GRETTA News and Weather feed". I unchecked it "GRETTA News and Weather feed" and I didn't get the error.
So now I use the  ""GRETTA News and Weather feed" for latest news but not weather I would prefer yours, so how can I get these two plugins to play well together??

Any ideas??
Title: Re: Weather Alert V5
Post by: Art on November 09, 2016, 07:22:43 am
Obviously since they can't BOTH get the weather at the same time, you'll have to "disable" that feature in one of the Plug-ins.

I did not write the Plug-ins and I don't have them at my disposal at the moment but you can easily scan through them with your average Text Editor. Choose which file and look for either an ID, Four letter Callsign or ZipCode that designates your location in question. You can delete it or put a ' in front of it to remark it out (from being read by the script file).

Play with it and be sure to save your work. After each change you'll need to restart Hal for the changes to take place.

Good luck!
Title: Re: Weather Alert V5
Post by: DayWalker on November 09, 2016, 11:43:24 am
Yeah. I was thinking along those lines to get these two to work.
I am trying also how to figure out how to get a plugin done for
Sunrise / Sunset and Moonrise /Moonset done
Title: Re: Weather Alert V5
Post by: Art on November 10, 2016, 07:09:02 am
The USNO (U.S.Naval Observatory) will provide the data you need, depending on your location.
Try using the form(s) they've provided. I would think that you would be looking for textual data for Hal to use/display.
You can easily input your particular location within the USA but tying that data to Hal might be another issue. Hmm...

Daily: http://aa.usno.navy.mil/data/docs/RS_OneDay.php (http://aa.usno.navy.mil/data/docs/RS_OneDay.php)

Yearly: http://aa.usno.navy.mil/data/docs/RS_OneYear.php (http://aa.usno.navy.mil/data/docs/RS_OneYear.php)

This might prove of interest to you as well: https://www.timeanddate.com/windows/ (https://www.timeanddate.com/windows/)
Title: Re: Weather Alert V5
Post by: DayWalker on November 10, 2016, 12:51:17 pm
Thank you so much!!
Yes I am trying to figure out how to get HAL to display the "daily"
information from the website
http://aa.usno.navy.mil/rstt/onedaytable?ID=AA&year=2016&month=11&day=10&state=FL&place=boca+raton
My thoughts are
1.) I would ask him a question like (what is the sunrise for today?)
and he would would open the above link and I would also lime him to read it to me. But I am trying to figure it out and not getting far with the code.
Title: Re: Weather Alert V5
Post by: Art on November 10, 2016, 08:09:39 pm
Good luck with it!

Sort of in line with your interest in time and weather, I'm not sure how much searching through the archives you've done.  One of our members, R.A. McCoid wrote a Plug-in called, "Knowledge of Time", that you might be interested in. He was helped by OTCE2005 as well. It is a pretty extensive and "timely" project.

If you decide to try it, good advice for it and all Plug-ins, is to uncheck all current Plug-ins and only try the one you're adding. If it runs without incident, then stop, Add one more. Start Hal again and try to see of they both (Plug-ins) work without problem. Keep doing this until you have all the ones you're interested in using.

Sometimes one Plug-in might make a same or similar call to the system at the same time causing a conflict, so it's best to try them in the manner I've described above until you can make sure they'll "play nicely" together!  ;)

Have fun!(make a backup of your Hal's Brain file before changing anything in the script. It's the one with the .db extension like Halbrain.db).

I've attached the KOT Plug-in in case you might be interested or just to examine it.
Title: Re: Weather Alert V5
Post by: DayWalker on November 10, 2016, 08:34:24 pm
Thank you, yeah I have my work cut out for me.
Title: Re: Weather Alert V5
Post by: Spitfire2600 on November 13, 2016, 03:33:17 am
Sorry, I should have explained the process for getting your location.

Thanks above for explaining.

Also, You can not run any other weather parsing plugins at the same time unless you change the variable commands for retrieving the information. "What is the weather"

I can add the sun/moon rise and set into the next version and anything else, just need links to sites that are php or xml friendly.

-Spitfire
Title: Re: Weather Alert V5
Post by: DayWalker on November 13, 2016, 10:24:08 am
Good morning Sir,
 Thank you for answering back.here is the link to the php website (this is the main page)
http://aa.usno.navy.mil/data/docs/RS_OneDay.php

From here I use this
(Form A - U.S. Cities or Towns) enter my information and click "get data"

which take me to here (the location I am looking for)
http://aa.usno.navy.mil/rstt/onedaytable?ID=AA&year=2016&month=11&day=13&state=FL&place=Boca+Raton

on this php webpage my sunrise/sunset and moon rise/moon set as well as moon phase are here as well as other information.

Now if you can get this to work it would be AWESOME!!
But there is a few things I would like to point out. Look at the php string
http://aa.usno.navy.mil/rstt/onedaytable?ID=AA&year=2016&month=11&day=13&state=FL&place=Boca+Raton
I highlighted it in RED as well as made bold.
This is updated  daily so how could you make this work/happen,so that it is current?
Also could you get Hal to repeat the other information as well...the text ?

OR maybe if the above can't be done then maybe have your plugin navigate to the php website
http://aa.usno.navy.mil/data/docs/RS_OneDay.php

and we then do the rest ourselves.
(Form A - U.S. Cities or Towns) enter my information and click "get data".

Thank you
Title: Re: Weather Alert V5
Post by: DayWalker on November 13, 2016, 10:28:44 am
Yes I was able to address my problems with Art's help and the 2 plugins play well together now. I really like your weather plugin. Works so nicely and I like the GRETTA News Feeds as I like to have it read to me as I work. So now I have the best of BOTH worlds.
Thank you guys for all that you do. I just wish I was as good as some of you with writing code.
Title: Re: Weather Alert V5
Post by: DayWalker on December 11, 2016, 02:41:22 pm
I was wondering if there has been any luck with this plugin?