dupa

Author Topic: Hal 6 and weather  (Read 10858 times)

caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« on: February 11, 2007, 09:44:16 pm »
Hi all I was wondering if a plugin could be made where hal will tell you the weather not just open a web page maybe make it that it will check the weather every 60 min or something like that thanks caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #1 on: February 11, 2007, 10:55:22 pm »
"The weather" is a pretty wide subject, but yes, a plugin can be made to read many sorts of information off the web and then have Hal read them to you. I made a basic RSS header plugin, that reads just the headlines and you can ask Hal for a random one. I suspect that weather pages have RSS feeds of various sorts that you could tap into.

I'll think about it tomorrow. Maybe check boxes so you can decide what parts of "the weather" you mainly want to know.


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #2 on: February 11, 2007, 11:10:05 pm »
cool thank you caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #3 on: February 12, 2007, 09:02:02 pm »
quote:
Originally posted by Bill DeWitt
I'll think about it tomorrow.


I found some weather feeds, but the one I like is actually an xml feed and my rss plugin doesn't work on it as I would like. I have to learn how to parse xml items first, but when I do I have it ready to read you the various local current observations and the forcast. May be a couple of days, because my mind is inherently incapable of absorbing new information.

BTW, here is the feed

<http://www.weather.gov/data/current_obs/>


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #4 on: February 12, 2007, 09:48:06 pm »
thank you for what your doing I am sure it will be very cool caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #5 on: February 12, 2007, 10:58:51 pm »
For now you will have to do some editing yourself, to input the actual feed you really want. The one there gives weather in Vermont. Go to the feed I posted earlier, find your prefered location and subsitute the url for the one I used. The important part is the last part "XXXX.xml", you should find a four letter station id which is the weather station near your location. Mine is KVSF. Change that part to your station id and it should work.

Let me know if you have any problems, and keep an eye out for improvements in the next few days. Forcasts may require learning how to use the NDFD XML Simple Object Access Protocol (SOAP) server. Might take a while....

Weather Alert 2
« Last Edit: February 12, 2007, 11:10:32 pm by Bill DeWitt »


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #6 on: February 12, 2007, 11:38:18 pm »
not to sure what I am doing here after the page is edited what do you save it as and where do you put it am very bad at all this caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #7 on: February 12, 2007, 11:47:56 pm »
Sorry, I thought you knew... my mistake.

Copy the code into a text editor, change the url, then save it as "WeatherAlert.uhp" in your UltraHal directory. Then restart Hal. You should then be able to find the plugin in the "General Options > Brain" dialog. Look for and put a check mark in "WeatherAlert 2".

Then to ask for the weather, say something like, "What does the National Weather Service say?" being sure to include the phrase "National Weather Service".

Later, I will make a sentence parsing function for it, to allow you to say different things and get the same result.
« Last Edit: February 12, 2007, 11:48:27 pm by Bill DeWitt »


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #8 on: February 13, 2007, 12:01:02 am »
thank you I cant beleave I did it right it is working it opens the webpage and then reads it to you thanks for your help caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #9 on: February 13, 2007, 06:45:07 am »
Good.

The page being opened must be from another weather plugin or something. Mine should just read the NWS information.


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #10 on: February 13, 2007, 01:38:44 pm »
I unchecked the other plugin and then hal just read the weather a very cool plugin thank you caangel

caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #11 on: February 16, 2007, 02:56:30 pm »
Bill any news on a update on weather I was thinking can you made it that you ask how the weather is and hal reads to you if that can be done thanks Caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #12 on: February 16, 2007, 07:31:42 pm »
There is progress, but I got distracted into making it keep a record and display a graph of past weather conditions. That works fairly well, if you have Excel on your machine.

I can take some time to fix the input parsing so that you can make a more general question work, that's pretty easy. Maybe tomorrow...


caangel43

  • Hero Member
  • *****
  • Posts: 931
    • View Profile
    • http://www.puttyheadworld.com
Hal 6 and weather
« Reply #13 on: February 16, 2007, 07:45:04 pm »
I dont have that program but thank you for your help I like the plugin alot caangel

Bill DeWitt

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Hal 6 and weather
« Reply #14 on: February 16, 2007, 10:44:14 pm »
I posted a slight update at the link above which allows you to ask for the weather in a wider variety of sentences.

Copy this over the old version and save it, then uncheck the weather plugin, click OK, go back into options and recheck the weather plugin. This resets Hal to include the new version. Then you should be able to use it.

If you look at it, you can see the range of phrases it checks for. You can add or change them as you see fit, as long as you leave the first two and the last line of the new section as they are. For instance, if you wanted to be able to just say "weather report" and get the response, you could simply add this line in the middle of the group:

   InStr(1,OriginalSentence, "report",1) Or _

This would make Hal check each sentence for "weather" then any sentence with "weather" would also be checked for "report". If both criteria are met, Hal will respond with the weather report.


Let me know if you have any problems.
« Last Edit: February 16, 2007, 10:46:30 pm by Bill DeWitt »