Announcement

Collapse
No announcement yet.

Revised XML Based Weather Script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Revised XML Based Weather Script

    Discuss the XML Based Weather Script here.

    Let me know what you think.

    #2
    I made a small change in the FormatForecastStringHTML function to make the date formatting in the forecast more consistent. I was getting stray chars at the end of the day.

    tempdate = Right(tempdate, (len(tempdate) - (len(day)+2)))

    I don't use the speech portion but it would probably work there as well.

    Comment


      #3
      Thanks Rob - I was just going to put a post up about the date problem, and you already had the solution!

      Comment


        #4
        When I made the same change to the script, I lost the month. So I took a look at my regional settings and changed to match dddd, MMMM dd, yyyy and it worked. My origianl setting was, ddd, mmm dd, yyyy, which does not appear to be a standard setting. I must have changed it for a reason, oh well not sure why now.

        I have also noticed some problems with the current condition icon. In the XML file it refers to the MSNBC site, and I assummed that the data was coming from MSNBC. Earlier this moring the condition icon was a Sun from the XML and Moon on the MSNBC site. Have you seen this as well?

        I may send them an email and see if I can get clarification.

        Thanks for the suggestion.

        Rick

        Comment


          #5
          Rick - After fixing the date, I thought I'd go to the site itself to see what data was being parsed. I entered the info for Cherry Hill NJ, and got a different set of data than what is being displayed. For example:

          Conditions: Script says "Mostly Sunny", site say "Mostly Cloudy".

          Wind: Script says "13 MPH", site says "18 MPH"

          Same with the other values. My settings.ini [location] shows Cherry Hill as the city, NJ as the state, and 08003 as the zip. All correct.

          (I'd also like to change the Texas flag to NJ - what site did you get the icon from?)

          Thanks

          Comment


            #6
            I have noticed these irregularities as well. I am going to send an email to confirm a few things. In the XML it indicates when the update occurred, I seen update time earlier than the current time. Hopefully I can get some info from them.

            The Texas flag is home made.

            Did find this web site, but they are a litle on the large side. http://www.iconbazaar.com/flags/usa/index.html

            Comment


              #7
              Is there anyway you could make a separate ini file for this script. This way if I decide not to keep using this or any other script it doesn't leave information behind in my HS ini file.

              -Rupp
              ...One Nation Under GOD, Indivisible, With Liberty And Justice For All.
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                I noticed on the forecast (Westport, CT) that each day had some porton of the end of the day repeated. I copied it for you to see below but first noticed it when Agent was speaking the forecast:

                Sunday
                y, December 01, 2002
                High: 36°
                Low: 22°
                Condition: Windy
                Precipitation: 0%
                Monday
                y, December 02, 2002
                High: 38°
                Low: 20°
                Condition: Flurries
                Precipitation: 30%
                Tuesday
                ay, December 03, 2002
                High: 36°
                Low: 20°
                Condition: Partly Cloudy
                Precipitation: 0%
                Wednesday
                sday, December 04, 2002
                High: 34°
                Low: 23°
                Condition: Cloudy
                Precipitation: 20%
                Thursday
                day, December 05, 2002
                High: 38°
                Low: 19°
                Condition: Flurries
                Precipitation: 30%

                Comment


                  #9
                  Did you fix the script by changing the line that Rob posted?
                  I had the same extra letters and the problem was fixed by changing the line posted above.

                  Dan-O
                  My system specs are in my profile
                  (Current beta as always)



                  Dan-O
                  HomeSeer contributor since summer 1999, yes 1999!

                  Comment


                    #10
                    Hi all,

                    Just installed this script, worked fine out of the box, apart from:

                    1) Here in the UK, we use dd/mm/yy as our date format. How do I change this in the script?

                    2) 'Updated' times are given in EST. Again, GMT is our flavo(u)r - can I change this too?

                    Otherwise, great job! I got totally peed off with weather.com changing their html every few days and messing up my settings. Hopefully this should sort things...

                    Any help appreciated!

                    ~David (XML? Not a clue, mate!)

                    Comment


                      #11
                      In the functions FormatForecastStringHTML and FormatForecastStringSpeech modify the following 2 lines to meet your needs.

                      tempdate = formatdatetime(date, vbLongDate)
                      tempdate = Right(tempdate, (len(tempdate) - (len(day) + 2)))

                      Be sure to keep the variable tempdate, it is used in the next line. Also let me know what you did and I will include it in the script.

                      Rupp:
                      I will include that in the next release.

                      Comment


                        #12
                        [img]/infopop/emoticons/icon_smile.gif[/img]

                        -Rupp
                        ...One Nation Under GOD, Indivisible, With Liberty And Justice For All.
                        💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                        Comment


                          #13
                          I fixed the date problem and created a seperate .ini file for the settings. To install over an existing system:

                          1. Remove the location section from HS settings.ini
                          2. Run the new script and answer the questions.

                          That's all.

                          Rick

                          Comment


                            #14
                            Rick,

                            Thanks for the reply - it's not quite sorted it. I've ended up making the following amendments to the sections you recommended like this :

                            <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>function FormatForecastStringHTML(day, date, high, low, condition, rain)
                            dim forecast
                            dim tempdate

                            tempdate = formatdatetime(date, vbLongDate)
                            ' tempdate = Right(tempdate, (len(tempdate) - (len(day) + 5)))
                            forecast = "&lt;B&gt;&lt;U&gt;&lt;br&gt;" & day & " " & tempdate & "&lt;/B&gt;&lt;/U&gt;"
                            forecast = forecast & "&lt;BR&gt;High:&nbsp;" & high & "&deg"
                            forecast = forecast & "&lt;BR&gt;Low:&nbsp;" & low & "&deg"
                            forecast = forecast & "&lt;BR&gt;Condition:&nbsp;" & condition
                            forecast = forecast & "&lt;BR&gt;Precipitation:&nbsp;" & rain & "%"

                            FormatForecastStringHTML = forecast

                            end function <HR></BLOCKQUOTE>

                            So simply remarked out the second 'tempdate=' line and I get the full date as required. The only problem is it's still reading days as months, as you can see from this screengrab...



                            Help!

                            Comment


                              #15
                              How often is this XML data being updated?

                              -Rupp
                              ...One Nation Under GOD, Indivisible, With Liberty And Justice For All.
                              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                              Comment

                              Working...
                              X