dupa

Author Topic: Weather Alert V5  (Read 8705 times)

Spitfire2600

  • Full Member
  • ***
  • Posts: 229
    • View Profile
Weather Alert V5
« 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     
« Last Edit: October 30, 2016, 04:30:12 am by Spitfire2600 »
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Weather Alert V5
« Reply #1 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.  ;)

In the world of AI it's the thought that counts!

- Art -

doggs

  • Sr. Member
  • ****
  • Posts: 371
    • View Profile
Re: Weather Alert V5
« Reply #2 on: October 31, 2016, 07:53:51 am »
cool
be informed and always vote it will help you in the long run does not matter if your liberal, conservative or independent. stay informed and watch the votes in government not what the media tells you.

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #3 on: November 05, 2016, 07:27:51 pm »
I would like to thank you guys for all your hard work to Hal.

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #4 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

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Weather Alert V5
« Reply #5 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

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.

« Last Edit: November 24, 2019, 09:13:42 am by Art »
In the world of AI it's the thought that counts!

- Art -

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #6 on: November 07, 2016, 07:14:56 pm »
Thank you for your help. Have a good evening.

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #7 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.

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #8 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.

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #9 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??

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Weather Alert V5
« Reply #10 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!
In the world of AI it's the thought that counts!

- Art -

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #11 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

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Weather Alert V5
« Reply #12 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

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

This might prove of interest to you as well: https://www.timeanddate.com/windows/
In the world of AI it's the thought that counts!

- Art -

DayWalker

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Weather Alert V5
« Reply #13 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.

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3739
    • View Profile
Re: Weather Alert V5
« Reply #14 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.
« Last Edit: November 10, 2016, 08:11:18 pm by Art »
In the world of AI it's the thought that counts!

- Art -