Announcement

Collapse
No announcement yet.

[VB.NET] my.Alert

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

    #61
    Tried a ton of things.
    Still can not get this to work.

    Thanks,
    Tim
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    Comment


      #62
      The URL is now https://waterdata.usgs.gov/usa/nwis/uv?site_no=06604200

      (https rather than http). Have you tried that?
      Jon

      Comment


        #63
        Yes, tried all that already.

        It will come up as - https://waterdata.usgs.gov/ia/nwis/uv?06604200
        or ---------------- https://waterdata.usgs.gov/usa/nwis/uv?site_no=06604200


        Still get the same error.

        Thanks,
        Tim
        FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

        HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

        Comment


          #64
          This is in my ini file

          PHP Code:
          [laketemp]
          URL=https://waterdata.usgs.gov/usa/nwis/uv?site_no=06604200
          RegExSearch=Most recent instantaneous value:\s(?<temp>[0-9]{1,3}\.[0-9])\s
          RegExReplace
          =temp
          DeviceString
          =I20
          Content
          =1.5

          [lakestage]
          URL=https://waterdata.usgs.gov/ia/nwis/uv?06604200
          RegExSearch=Most recent instantaneous value:\s(?<stage>[0-9]{1,3}\.[0-9][0-9])\s
          RegExReplace
          =stage
          DeviceString
          =I28
          Content
          =4.46 
          Numbers haven't changed since Dec 14th

          Thanks,
          Tim
          Last edited by fungun; January 3, 2017, 02:06 PM. Reason: The board took out some coding
          FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

          HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

          Comment


            #65
            Sorry I cannot assist further unless you move it across to HS3 and use my Datascraper....
            Jon

            Comment


              #66
              Not quite ready for HS3 just yet, sorry.
              Still watching the x10 stuff get fixed up.
              But thank you for trying.

              Tim
              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

              HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

              Comment


                #67
                Well, I emailed the USGS and asked them about the error. Hereis what I got back. I went to the site they suggested, but you have to manually input the info you want.
                Don't know how that is going to work

                USGS Response:

                Dear Tim,

                I suspect your error is related to our 12/14/2016 switch to HTTPS secure protocol described in this news article:

                https://help.waterdata.usgs.gov/news...%205%2C%202016

                From the error trace it's unclear what steps might be needed. Perhaps simply changing http:// to https:// in the software or its configuration file. But it also is possible a deeper change is needed to enable HTTPS encryption (aka Secure Socket Layer, or SSL).



                Unrelated to the issue at hand, but a suggestion: you might consider https://waterservices.usgs.gov/ instead of waterdata.usgs.gov. waterservices' offers friendlier ("better", perhaps) web services for software, including several choices of output formats. But it too requires the use of the HTTPS encrypted protocol.



                Please contact me (bdgarner@usgs.gov) if you have further questions.



                Sincerely,

                Brad Garner

                Product Owner, USGS Water Data for the Nation
                Thanks,
                Tim
                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                Comment


                  #68
                  Well, it did work.
                  You generate a url with the info you want on their site (which is why I didn't think it would work) but I ran the url today and it does give today's date and time.
                  https://waterservices.usgs.gov/nwis/...siteStatus=all

                  I looked at the page source and it comes out like a text file.

                  PHP Code:
                  # ---------------------------------- WARNING ----------------------------------------
                  # Provisional data are subject to revision. Go to
                  # http://help.waterdata.usgs.gov/policies/provisional-data-statement for more information.
                  #
                  # File-format description:  http://help.waterdata.usgs.gov/faq/about-tab-delimited-output
                  # Automated-retrieval info: http://help.waterdata.usgs.gov/faq/automated-retrievals
                  #
                  # Contact:   gs-w_support_nwisweb@usgs.gov
                  # retrieved: 2017-01-04 12:15:26 -05:00    (natwebsdas01)
                  #
                  # Data for the following 1 site(s) are contained in this file
                  #    USGS 06604200 West Okoboji Lake at Lakeside Lab near Milford, IA
                  # -----------------------------------------------------------------------------------
                  #
                  # TS_ID - An internal number representing a time series.
                  #
                  # Data provided for site 06604200
                  #    TS_ID       Parameter Description
                  #    44524       00010     Temperature, water, degrees Celsius
                  #    44523       00065     Gage height, feet
                  #
                  # Data-value qualification codes included in this output:
                  #     P  Provisional data subject to revision.
                  #
                  agency_cd    site_no    datetime    tz_cd    44524_00010    44524_00010_cd    44523_00065    44523_00065_cd
                  5s    15s    20d    6s    14n    10s    14n    10s
                  USGS    06604200    2017
                  -01-04 10:45    CST    1.7    P    4.53    P 
                  So now how do I extract the values of "1.7" and "4.53" ?
                  Those are the Temp in C and the Stage level of the lake. I should probably get the date and time too.

                  Thanks,
                  Tim
                  FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                  HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                  Comment


                    #69
                    It also looks like I can output a xml file. Maybe that would be easier. (?)

                    Thanks,
                    Tim

                    https://waterservices.usgs.gov/nwis/...siteStatus=all
                    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                    Comment


                      #70
                      Time you ditched that old X10 stuff and moved to HS3
                      Jon

                      Comment


                        #71
                        Originally posted by fungun View Post
                        It also looks like I can output a xml file. Maybe that would be easier. (?)

                        Thanks,
                        Tim

                        https://waterservices.usgs.gov/nwis/...siteStatus=all
                        XML is typically easy to parse. There are some great scripts floating around the forum for doing so. I think these are all written for HS3, but there may be some around for HS2 too.

                        Cheers
                        Al
                        HS 4.2.8.0: 2134 Devices 1252 Events
                        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                        Comment


                          #72
                          Ok , I looked at a few. Some are very old, like from 2004.
                          I am getting confused on the "nodes" stuff.
                          Are the "nodes" the lines you want parsed in the xml file itself?
                          If so, how am I going to get 2 values that have the same "node" name?

                          ex -
                          PHP Code:
                          <wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>1.6</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/>



                          <
                          wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>4.51</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/> 
                          I need the 1.6 and 4.51 and just one of the date-time.

                          Thanks,
                          Tim
                          FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                          HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                          Comment


                            #73
                            Originally posted by fungun View Post
                            Ok , I looked at a few. Some are very old, like from 2004.
                            I am getting confused on the "nodes" stuff.
                            Are the "nodes" the lines you want parsed in the xml file itself?
                            If so, how am I going to get 2 values that have the same "node" name?

                            ex -
                            PHP Code:
                            <wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>1.6</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/>



                            <
                            wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>4.51</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/> 
                            I need the 1.6 and 4.51 and just one of the date-time.

                            Thanks,
                            Tim
                            Every element in an xml is considered a node. There is an xml function that will return all the nodes with the same name as an array. Take a look at the VB examples here: https://msdn.microsoft.com/en-us/lib...code-snippet-2

                            Cheers
                            Al
                            HS 4.2.8.0: 2134 Devices 1252 Events
                            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                            Comment


                              #74
                              Well I am assuming this script works because I get no error for the script itself.
                              However I still get the same error I got from before. I won't copy the whole error, it's very long.
                              So now I am under the assumption I will have to download the xml file or the tab file and then try to parse one of them.
                              First the script, then the error.

                              Thanks,
                              Tim

                              PHP Code:
                              Imports System.XML
                              '*************************************************************************
                              '
                              wunderground_XML.vb Pull the current temperature and wind from any of
                              '*      multiple Weather Underground stations. (version 1.0)
                              '
                              By Steve Anderson (Snevl)
                              '*************************************************************************

                              Const lakeT_dev As String "I20"
                              'Const lakeG_dev As String = "W61"

                              Sub Main(ByVal Parms as Object)

                                  Dim lakeT as String
                                  '
                              Dim lakeG as String
                                  Dim XMLdoc 
                              as XMLDocument = New XMLDocument()

                                          
                              XMLdoc.Load("https://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&sites=06604200¶meterCd=00060,00065,00010&siteType=LK&siteStatus=all")
                                      
                              Dim book as XmlNode
                                      Dim root 
                              as XmlNode XMLdoc.DocumentElement

                                      book
                              =root.SelectSingleNode("<wml2:value>")
                                      
                              lakeT book.InnerText        
                                      hs
                              .SetDeviceString(lakeT_dev,lakeT,TRUE)

                                      
                              'book=root.SelectSingleNode("//current_observation/UV")        
                                      '
                              lakeG book.InnerText        
                                      
                              'hs.SetDeviceString(lakeG_dev,lakeG,TRUE)

                                      

                              End Sub 

                              PHP Code:
                              1/6/2017 6:14:18 PM ~!~Event~!~Running script in backgroundLakeTempStage010617.vb
                              1
                              /6/2017 6:14:21 PM ~!~Error~!~Scripting runtime errorSystem.Reflection.TargetInvocationExceptionException has been thrown by the target of an invocation. ---> System.Net.WebExceptionThe underlying connection was closedAn unexpected error occurred on a send. ---> System.IO.IOExceptionReceived an unexpected EOF or 0 bytes from the transport stream.   at System.Net.FixedSizeReader.ReadPacket(Byte[] bufferInt32 offsetInt32 count)   at System.Net.Security.SslState.StartReadFrame(Byte[] bufferInt32 readBytesAsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.Start 
                              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                              HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                              Comment


                                #75
                                jon00
                                Sorry I cannot assist further unless you move it across to HS3 and use my Datascraper....
                                So will your Datascraper get past the https or the ssl stuff?

                                Thanks,
                                Tim
                                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                                HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                                Comment

                                Working...
                                X