Any one have a script to track the oil per barrel price? and put it into a device?or speak it?
Announcement
Collapse
No announcement yet.
Oil per Barrel Price Script
Collapse
X
-
Thanks Stuart could not have do it with out you. Here is the script works fine.Attached FilesLast 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
-
MeSteve
Question, what is the purpose of replacing "" with ""? And why 3 times?
Code:Strdata = Replace(Strdata,"","") Strdata = Replace(Strdata,"","") Strdata = Replace(Strdata,"","")
Comment
-
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
Comment
-
MeSteve
-
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 greatHS4 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
-
The site that the script gets its info from has no price present.
www.quoteoil.comHS4 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
-
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 FilesHS4 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
-
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
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
Comment