Announcement

Collapse
No announcement yet.

Water Temp Script needs help

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

    Water Temp Script needs help

    I had a water temp script (attached) that once worked, but now does not. If someone gets a chance could you take a look at my attached script, and let me know what I am doing wrong? Below is the html where I am pulling it from. I am trying to learn how to script, and I would like to know the most reliable way to pull the water temp from the html below. Thanks.

    <TR>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff" class="captionText" align="left"><FONT COLOR="#214486">Sea Surface Temp:</FONT></TD>
    <TD bgcolor="#d7ecff" class="captionText" align="left"><FONT COLOR="#214486">37 F</FONT></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    <TD bgcolor="#d7ecff"><IMG SRC="http://image.weather.com/web/blank.gif" WIDTH="1" HEIGHT="2" BORDER="0" ALT=""></TD>
    </TR>
    Attached Files

    #2
    Beach,

    I just ran your script and it seems to be working fine. It spoke:

    The water temperature is 37 degrees.
    The water is quite cold today.

    There was also a debug statement that printed out 37.

    Joe
    HomeSeer Rocks!

    Comment


      #3
      From time to time the weather channel site blocks their web pages from direct access. I have moved all my scripts away from their site because rarely do I get any images from them. They put up a messages stating you need to visit www.weather.com if you want this content.

      -Rupp
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        I can't believe it works for you! It does not work for me anymore. I get an error in line 20 or so that says "mid" error. What could this be?

        Comment


          #5
          Your line 20 is strBody=Mid(strBody,1,x)

          x is defined previously by an InStr functon. If x ends up being 0 then you will get an error. Do a check like:

          if x <> 0 then
          strBody=Mid(strBody,1,x)
          else
          ...
          end if

          Cheers,

          Mitch

          http://www.midondesign.com
          http://www.midondesign.com

          Comment


            #6
            Mitch,

            But how come it works on one computer, but not on mine? It works on my friends, and we both have the same setup?

            Comment


              #7
              As I previously stated Weather.com is randomly blocking access to its web pages. Wait a few days and maybe you can get back in.

              -Rupp
              💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

              Comment


                #8
                Rupp is right. If your web page call returns an empty page, or partial page, for example, the string function may work up until you check that last parameter in line 19. That would fail line 20.

                Mitch

                http://www.midondesign.com
                http://www.midondesign.com

                Comment


                  #9
                  Do you have any other scripts that use GetURL that are working? I’ve read posts in the past where users have reported intermittent problems with GetURL, although, I’ve never had an issue with it before. If you haven’t already, I would clear out your temporary Internet files. I’ve seen really strange stuff happen when they aren’t cleared often enough.

                  As a test, I’ve been running your script several times an hour and it hasn’t missed once.

                  Mitch is totally correct that the error you are getting is a result from an empty page or partial page and that error needs to be trapped.

                  I know that weather.com refuses the maps at different times during the day but I’ve never experienced a problem retrieving the contents of a web page in the past. I’ve seen weather.com change the format of the page but I can’t remember ever being refused. However, just because I haven’t, that doesn’t really mean a thing. If Rupp says they do, then I’d take his word for it.

                  Do you have a dynamic IP? If you do and if your GetURL is working for other scripts, I would suggest changing your IP and see if that gets you anywhere. If you have DSL you can reset your modem to get a new IP or go to the config page of your router to disconnect/reconnect. It’s possible your IP has been flagged and that may be why you are getting refused.

                  I’m sure you’ve heard this before, but your best bet for all of this though is to find an XML feed and not scrape the web page. Weather.com along with other sites are doing there best to persuade users from scraping.

                  Joe
                  HomeSeer Rocks!

                  Comment


                    #10
                    Thank you everyone for the suggestions. I will try everything. Do any of you know where I can get info like water temp, wave height, etc other than weather.com?

                    Comment


                      #11
                      Any of these bouys near enough to you?

                      http://www.ndbc.noaa.gov/Maps/Northeast.shtml


                      Hoe far is this bouy station?
                      http://www.co-ops.nos.noaa.gov/cgi-b...gi?stn=8531680


                      -Rupp
                      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                      Comment


                        #12
                        Thanks Rupp. I'll check them out.

                        Comment

                        Working...
                        X