Announcement

Collapse

Contacting HomeSeer This Week

HomeSeer is open and operational this week. All orders are being processed and shipped as usual. However, some staff are working from home. If you need to contact HomeSeer for support or customer service, please use our Email or Chat options. https://homeseer.com/contact-us/
See more
See less

[VB.NET] my.Alert

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

  • #31
    Originally posted by electron View Post
    What happens when you load the JavaScript file directly? In theory, you can monitor any file, but that's assuming there isn't some other weird stuff going on.
    There are many JavaScript files in the page. For example, this is the source for the page I want to scrape:

    Code:
    <linktype="text/css"href="js/jquery-ui-1.8.1/css/smoothness/jquery-ui-1.8.1.custom.css"rel="Stylesheet"/>
    <scripttype="text/javascript"src="js/jquery-1.7.1.min.js"></< font>script>
    <scripttype="text/javascript"src="js/jquery-ui-1.8.1/js/jquery-ui-1.8.16.custom.min.js"></< font>script>
    
    <scriptlanguage="javascript"type="text/javascript"src="js/flot/jquery.flot.js"></< font>script>
    <scriptlanguage="javascript"type="text/javascript"src="js/flot/jquery.flot.selection.js"></< font>script>
    <scriptlanguage="javascript"type="text/javascript"src="js/flot/jquery.flot.pie.js"></< font>script>
    <linktype="text/css"href="css/measure_it.css"rel="Stylesheet"/>
    <scriptlanguage="javascript"type="text/javascript">var pc = 1;</< font>script>
    <scriptlanguage="javascript"type="text/javascript"src="js/measureit.js"></< font>script>
    <divid="main">
    <divid="nav-top">
    <divid="tabs">
    <ulid="tabcontainer"></< font>ul>
    <divid="tabs-1000">
    <divid="summary"></< font>div>
    </< font>div>
    <divid="tabs-1011"/>
    </< font>div>
    </< font>div>
    </< font>div>
    

    Comment


    • #32
      You'll have to drill down to the right file. I'm extremely busy right now, but if you share the link and text you are looking for, I can try to help you figure this out.
      HSPRO 2.4 (ESXi 4.1) | my.Alert NEW | my.Trigger | HSTouch | ACRF2 | UltraM1G | BLWeather | BLLan | Rover
      (aka xplosiv)
      Do You Cocoon? Home Automation News, Tutorials, Reviews, Forums & Chat

      Comment


      • #33
        The issue is: What I'm looking for isn't in the files. The files contains just JavaScript and is when the client downloads it when the client browser executes (interpretes) the JavaScript and creates the actual HTML.

        Don't worry because as the server is running on my private network on a Raspberry PI I'll try to modify it so it serves "static HTML" easier to parse :-)

        Comment


        • #34
          Ok, I have been looking at this for awhile.

          Just don't get it.
          Here is the url
          Code:
          http://www.wunderground.com/sky/ShowSky.asp?CurDir=Up&TheLat=43.41941833&TheLon=-95.13288116&TimeZoneName=America/Chicago
          There are a TON of these
          PHP Code:
          <tr> <td
          on the page, but the only one I want is this one
          PHP Code:
          <td>Moon</td>
                  <
          td>11:53 AM CST</td>
                  <
          td>&nbsp;</td>
                  <
          td>11:44 PM CST</td
          So how do I do the regex to just look for this one tag?

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

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

          “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

          Comment


          • #35
            Need some help getting this to work.

            I'm on HS3. Installed script in scripts and created ini in config.
            Here's my ini

            [APEX_pH]
            URL=http://192.168.1.55:8282/cgi-bin/status.xml
            RegExSearch=<name>pH</name><value>[0-9]\.[0-9][0-9]
            RegExReplace=
            DeviceString=T1

            This is the section of the webpage I'm trying to get. I want the value between name pH and value. So, in this case, 8.14
            (I had to remove all the < and > as this forum was removing the xlm code from my message)

            probe
            name pH /name
            value 8.14 /value


            When I run my event, script, with these optional parameters
            ("monitor","3@APEX_pH")

            All I get in the HS log is this:

            Jan-16 11:48:22 AM Event Running script in background: C:/Program Files (x86)/HomeSeer HS3/scripts/myAlert.vb
            Jan-16 11:48:22 AM Event Event Trigger "Tank Get APEX pH"
            Jan-16 11:48:22 AM Event Event Tank Get APEX pH triggered by the event page 'Run' button.

            Can you help me figure out why the script doesn't seem to be running / returning any debug info?
            Also, I don't understand what the RegExReplace= option is for.

            Thanks!

            P.S. This looks awesome and I hope to use it for many use cases.

            -Mike
            Last edited by msbreton; January 16th, 2014, 03:03 PM.

            Comment


            • #36
              Has this been ported for HS3 now? I can't see an annoucement.

              Comment


              • #37
                Do scripts need to be ported? I thought that just applied to plug-ins.

                -Mike

                Comment


                • #38
                  I found another page I can't sort.
                  Here is the page source -
                  PHP Code:
                  <span class="pr">
                  <
                  span id="ref_464426_l">141.00</span>
                  </
                  span>
                  <
                  div class="id-price-change nwp">
                  <
                  span class="ch bld"><span class="chr" id="ref_464426_c">-1.15</span>
                  <
                  span class="chr" id="ref_464426_cp">(-0.81%)</span
                  Here is what I have in the ini file -
                  PHP Code:
                  [PolStockChng]
                  URL=http://www.google.com/finance?q=PII&ei=lhojVfCEDoeIsAfJlYHICw
                  RegExSearch=<span class="chr" id="ref_464426_c">(?<number>\[0-9]+\.[0-9]{2})</span>
                  RegExReplace=number
                  DeviceString
                  =s98
                  Content

                  I can't get it to work because I have no idea how to handle the "+" and or the "-" infront of the 1.15

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

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

                  “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                  Comment


                  • #39
                    Anyone?

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

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

                    “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                    Comment


                    • #40
                      Originally posted by fungun View Post
                      Anyone?

                      Thanks,
                      Tim
                      Try this

                      PHP Code:
                      RegExSearch=<span class="chr" id="ref_464426_c">(?<number>.*)</span

                      Comment


                      • #41
                        Thank you, that worked.
                        So how is it that I don't need all this -
                        PHP Code:
                        (?<number>\[0-9]+\.[0-9]{2}) 
                        Thanks again,
                        Tim
                        FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

                        “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                        Comment


                        • #42
                          Originally posted by fungun View Post
                          Thank you, that worked.
                          So how is it that I don't need all this -
                          PHP Code:
                          (?<number>\[0-9]+\.[0-9]{2}) 
                          Thanks again,
                          Tim
                          . = match any character that is NOT a line break (line feed)
                          * = between zero and unlimited times, as many times as possible

                          This should also work.
                          PHP Code:
                          <span class="ch bld"><span class="chr" id="ref_464426_c">(?<number>[+-][0-9]\.[0-9]{2})</span
                          [+-] = match a single character in this list
                          [0-9] = match a single character in the range "0" to "9"
                          + = between 1 and unlimited times, as many times a possible
                          \. = the literal character .
                          {2} = match exactly two times

                          The above would match +7.40 and -7.40, but not 7.40 and not +7.4 or -7.4
                          .* would match all five.

                          Clear as mud?

                          Comment


                          • #43
                            Yes, thanks for that explanation. It helps alot.

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

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

                            “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                            Comment


                            • #44
                              Never mind it helps if you use "http" and not "https"

                              Thanks,
                              Tim
                              Last edited by fungun; June 28th, 2015, 12:18 PM.
                              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

                              “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                              Comment


                              • #45
                                Ok, I guess I do have a problem.
                                I have tried different approaches and I either get what is in the pic below or i get no data at all.
                                Info is attached.

                                Thank you,
                                Tim
                                Attached Files
                                FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

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

                                “No, I’m from Iowa. I only work in outer space.” – Captain Kirk

                                Comment

                                Working...
                                X