Announcement

Collapse
No announcement yet.

[VB.NET] my.Alert

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

  • fungun
    replied
    It also looks like I can output a xml file. Maybe that would be easier. (?)

    Thanks,
    Tim

    https://waterservices.usgs.gov/nwis/...siteStatus=all

    Leave a comment:


  • fungun
    replied
    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

    Leave a comment:


  • fungun
    replied
    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

    Leave a comment:


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

    Tim

    Leave a comment:


  • jon00
    replied
    Sorry I cannot assist further unless you move it across to HS3 and use my Datascraper....

    Leave a comment:


  • fungun
    replied
    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

    Leave a comment:


  • fungun
    replied
    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

    Leave a comment:


  • jon00
    replied
    The URL is now https://waterdata.usgs.gov/usa/nwis/uv?site_no=06604200

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

    Leave a comment:


  • fungun
    replied
    Tried a ton of things.
    Still can not get this to work.

    Thanks,
    Tim

    Leave a comment:


  • fungun
    replied
    Still use this with HS2.
    Started getting the error below. Check the website and it is up and working fine.
    I don't understand the error.

    12/29/2016 5:30:53 PM ~!~my.Alert~!~Error --- An error has occurred while downloading data from http://waterdata.usgs.gov/usa/nwis/uv?site_no=06604200 : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream. at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.CheckCompletionBeforeNextReceiv e(ProtocolToken message, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsync Result lazyResult) at System.Net.TlsStream.CallProcessAuthentication(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWi thGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionConte xt executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) at System.Net.ConnectStream.WriteHeaders(Boolean async) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at scriptcode12.scriptcode12.GetData(String sURL)
    12/29/2016 5:30:53 PM ~!~my.Alert~!~Script Exception Error: Object reference not set to an instance of an object.

    Thanks,
    Tim

    Leave a comment:


  • tommyd75
    replied
    can't download myAlert.vb.txt

    I'm tying to download the file but it keeps hanging up, never downloads.

    Leave a comment:


  • tommyd75
    replied
    Using my.Alert with webpage that requires login

    Originally posted by electron View Post
    Discussion Thread for my.Alert.

    If you have any questions, suggestions or need help building the regular expression, don't hesitate to post here please!
    Can I use this on a webpage that requires login?
    I'm using Homeseer 2 and I just ordered an ecobee 3 thermostat and I was wondering if I could use this to get temperature for the website. I don't think there is a plugin for HS2 and this thermostat. I also don't have a login yet so I can't test it.
    Here is the webpage.
    https://www.ecobee.com/home/ecobeeLogin.jsp

    Leave a comment:


  • fungun
    replied
    Ha, that worked.
    I will remember that one

    Thank you again,
    Tim

    Leave a comment:


  • jon00
    replied
    For the second, Try:

    PHP Code:
    RegExSearch=Dissolved Ox...</td><td class="value">.*?</td></tr><tr><td class="parameter-name">Dissolved Ox...</td><td class="value">(.*?) mg/L</td>
    RegExReplace=

    Leave a comment:


  • fungun
    replied
    Here is how the ini comes out -
    PHP Code:
    [DissolvedOxy]
    URL=http://wqdatalive.com/public/470.
    RegExSearch=Dissolved Ox...</td><td class="value">(.*?) %</td>
    RegExReplace=1
    DeviceString
    =I84
    Content
    =100.1

    [DissolvedOxy2]
    URL=http://wqdatalive.com/public/470.
    RegExSearch=Dissolved Ox...</td><td class="value">(.*?) mg/L</td>
    RegExReplace=1
    DeviceString
    =I85
    Content
    =100.1 %Dissolved Ox...8.63 
    Thanks,
    Tim

    Leave a comment:

Working...
X