Announcement

Collapse
No announcement yet.

Getting XML data help

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

    Getting XML data help

    I have found some examples and made what I thought was the changes I need. But when the script runs I get the following error:

    Running script, script run or compile error in file: C:/Program Files/HomeSeer HS3/scripts/Weather_Read.txt430:Class doesn't support Automation: 'hs.setdevicestring' in line 13 More info: Class doesn't support Automation: 'hs.setdevicestring'

    Here is the script:

    Sub Main()

    Dim description, temperF

    Set xmlDoc = CreateObject("Msxml2.DOMDocument")
    xmldoc.async = False

    xmlDoc.load("http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=KNCINDIA5")

    Set ElemList = xmlDoc.getElementsByTagName("temp_f")
    temperF = ElemList.item(0).getAttribute("data")

    hs.setdevicestring "w100", "Outside Temperature: " & temperF & chr(176) & "F", True
    hs.setdevicevalue "w100", Cint(temperF)

    End Sub

    #2
    When HS3 came along quite a few of the scripting commands remained the same title however they expected different parameters. hs.setdevicestring being one of those - http://www.homeseer.com/support/home...vicestring.htm

    Comment


      #3
      So I changed it based on the example in the link. Now I get the following error:

      Running script, script run or compile error in file: C:/Program Files/HomeSeer HS3/scripts/Weather_Read.txt1044:Cannot use parentheses when calling a Sub in line 14 More info: Cannot use parentheses when calling a Sub

      Changed script:

      Sub Main()

      Dim description, temperF

      Set xmlDoc = CreateObject("Msxml2.DOMDocument")
      xmldoc.async = False

      xmlDoc.load("http://api.wunderground.com/weatherstation/WXCurrentObXML.asp?ID=KNCINDIA5")

      Set ElemList = xmlDoc.getElementsByTagName("temp_f")

      temperF = ElemList.item(0).getAttribute("data")

      hs.SetDeviceString(148, temperF, True)

      End Sub

      Comment


        #4
        Been a while since I messed in VBScript but I think it is going to be;

        hs.SetDeviceString 148, temperF, True

        The example in the help file is VB.net which needs the brackets around some of the calls

        Comment


          #5
          I really appreciate it!! That corrected it.

          Comment

          Working...
          X