Announcement

Collapse
No announcement yet.

Oil per Barrel Price Script

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

    Oil per Barrel Price Script

    Any one have a script to track the oil per barrel price? and put it into a device?or speak it?
    HS4 Environment
    Proxmox win11 / HS4
    Netiom-Xap board
    Plug-In's
    rnbWeather 4.4.2.0
    mcsMQTT V6.15.1.0
    mcsXap V3.0.0.72
    Zigbee Plus V1.0.0.0
    Zigbee V4.0.11.0

    There is no place Like 127.0.0.1

    #2
    this will give you a start...
    Stuart
    Attached Files

    Comment


      #3
      Thanks Stuart could not have do it with out you. Here is the script works fine.
      Attached Files
      Last edited by HomeTech; July 19, 2006, 06:12 AM.
      HS4 Environment
      Proxmox win11 / HS4
      Netiom-Xap board
      Plug-In's
      rnbWeather 4.4.2.0
      mcsMQTT V6.15.1.0
      mcsXap V3.0.0.72
      Zigbee Plus V1.0.0.0
      Zigbee V4.0.11.0

      There is no place Like 127.0.0.1

      Comment


        #4
        Question, what is the purpose of replacing "" with ""? And why 3 times?
        Code:
        Strdata = Replace(Strdata,"","")
        Strdata = Replace(Strdata,"","")
        Strdata = Replace(Strdata,"","")

        Comment


          #5
          Steve,
          The script posted doesn't have those lines. Maybe it was updated.

          HTML Code:
          Dim startint
          Dim Endint
          Dim Strdata
          
          Sub main()
          	
          	Strdata = hs.GetURL("www.quoteoil.com", "" & strZip, true, 80)
          
                  Strdata = Replace (Strdata, chr(9), "")
                  Strdata = Replace (Strdata, chr(10),"")
                  Strdata = Replace (Strdata, chr(13), "")
                  Strdata = Replace(Strdata,"<b>","")
                  Strdata = Replace(Strdata,"<br >","")
                  Strdata = Replace(Strdata,"</b>","")
                  	
          	startint = InStr(Strdata, "$")
          	Endint = InStr(startint, Strdata, "per barrel") + 10
          	strquote = Trim(Mid(Strdata, startint, Endint - startint ))
          	
                  Strquote= "Oil is " & strquote
                  
          	hs.speak strquote
                  end sub
          💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

          Comment


            #6
            The second version does.

            Comment


              #7
              Hi,
              when i first posted the script, I had to make the file an attachment, it didnt like the format.
              Stuart

              Comment


                #8
                Don't know how I did that cut and past is all I did to start. Thanks Rupp (Hawk eye)
                I have corrected the previous post.

                Works great
                HS4 Environment
                Proxmox win11 / HS4
                Netiom-Xap board
                Plug-In's
                rnbWeather 4.4.2.0
                mcsMQTT V6.15.1.0
                mcsXap V3.0.0.72
                Zigbee Plus V1.0.0.0
                Zigbee V4.0.11.0

                There is no place Like 127.0.0.1

                Comment


                  #9
                  Oil is $ per barrell

                  Anyone else getting the above string when going to quoteoil.com?

                  Just wondering, Later Terry
                  Last edited by tman1; July 31, 2006, 01:44 PM. Reason: DISLEXIA

                  Comment


                    #10
                    Originally posted by tman1
                    Anyone else getting the above string when going to oilquote.com?

                    Just wondering, Later Terry
                    Yes, just got it this morning.


                    Scott

                    Comment


                      #11
                      The site that the script gets its info from has no price present.
                      www.quoteoil.com
                      HS4 Environment
                      Proxmox win11 / HS4
                      Netiom-Xap board
                      Plug-In's
                      rnbWeather 4.4.2.0
                      mcsMQTT V6.15.1.0
                      mcsXap V3.0.0.72
                      Zigbee Plus V1.0.0.0
                      Zigbee V4.0.11.0

                      There is no place Like 127.0.0.1

                      Comment


                        #12
                        Oil Price Script stopped working

                        This was working but now when the script runs I get bellow:

                        Speak ():Oil is $(document).ready(function() { $("#responsecontainer").fadeOut(75).load("reload.php").fadeI n(75); $("#responsecontainer2").fadeOut(75).load("reload2.php").fad eIn(75); var refreshId = setInterval(function() { $("#responsecontainer").fadeOut(75).load('reload.php?randval ='+ Math.random()).fadeIn(75); $("#responsecontainer2").fadeOut(75).load('reload2.php?randv al='+ Math.random()).fadeIn(75); }, 7500);});en ar es fr de ru zhPrice of OilLight sweet crude oil-->$91.69 per barrel

                        I believe the web page changed a bit. Is there a fix that some one can offer? Thank you

                        The script I am running is attached.
                        Attached Files
                        HS4 Environment
                        Proxmox win11 / HS4
                        Netiom-Xap board
                        Plug-In's
                        rnbWeather 4.4.2.0
                        mcsMQTT V6.15.1.0
                        mcsXap V3.0.0.72
                        Zigbee Plus V1.0.0.0
                        Zigbee V4.0.11.0

                        There is no place Like 127.0.0.1

                        Comment


                          #13
                          This is a quick way (there may be better ways),

                          Code:
                          Dim Strdata
                          Dim LenStr
                          
                          Sub main()
                          
                          Strdata = hs.GetURL("www.quoteoil.com", "" & strZip, False, 80)
                          
                          LenStr = (Instr(strData, "< strong >") + 8) - (Instr(strData, "< /strong >") - 9)
                          
                          strQuote = Mid(StrData, Instr(strData, "< strong >") + 8, LenStr + 1)
                          
                          Strquote = "Oil is " & strquote
                          system.speak "C:\program files\HomeSeer HS2\wave\ToneAnnounce.wav",False
                          hs.WaitSecs 1
                          hs.system.speak strquote
                          virtualdevice = "N91"
                          hs.SetDeviceString virtualdevice,"" & Strquote, True 
                          
                          End Sub
                          Hopefully it works if the price goes above $100/barrel, thats the only problem I see - unless they change the page again

                          The board has a problem as it tries to parse the < strong > tags, please take the spaces out when you copy it into a script...

                          Comment


                            #14
                            This works now
                            Attached Files

                            Comment


                              #15
                              YES that fixed it THANKS!!!
                              HS4 Environment
                              Proxmox win11 / HS4
                              Netiom-Xap board
                              Plug-In's
                              rnbWeather 4.4.2.0
                              mcsMQTT V6.15.1.0
                              mcsXap V3.0.0.72
                              Zigbee Plus V1.0.0.0
                              Zigbee V4.0.11.0

                              There is no place Like 127.0.0.1

                              Comment

                              Working...
                              X