I am using XML to access data from a TED power monitor. I found the code fragments at: http://board.homeseer.com/showpost.p...7&postcount=36
My code is:
When I run it using tenScripting it runs fine. When I export it to HS Pro, I get the following error:
I suspect I'm missing an Include or something that is different with the environments, but I haven't be able to track it down.
My code is:
PHP Code:
Dim oXML As MSXML2.DOMDocument = CreateObject("Msxml.DOMDocument")
oXML.async = False
If oXML.load("http://172.16.10.29:3080/api/LiveData.xml") Then
Dim Solar_Power As String = oXML.selectSingleNode("/LiveData/Power/MTU3/PowerTDY").text
Solar_PowerWH = CDec(Solar_Power)
' Note: currently all values are negative, but with upcoming release, consumption will be positive (Inverters using some current)
' and generation negative. Exclude values when no generation is going on.
If Solar_PowerWH < 0 Then
Solar_PowerWH = -Solar_PowerWH
Else
Solar_PowerWH = 0
End If
hs.SetDeviceValue(virt_device_SolarPVGeneratedWh, Solar_PowerWH)
hs.SetDeviceString(virt_device_SolarPVGeneratedWh, CStr(Solar_PowerWH) & " Wh")
hs.SetDeviceLastChange(virt_device_SolarPVGeneratedWh, CurrentUpdateDateTime)
Else
LogIt( _
"Your XML Document failed to load" & _
" due the following error." & _
" Error #: " & oXML.parseError.errorCode & ": " & oXML.parseError.reason & _
" Line #: " & oXML.parseError.line & _
" Line Position: " & oXML.parseError.linepos & _
" Position In File: " & oXML.parseError.filepos & _
" Source Text: " & oXML.parseError.srcText & _
" Document URL: " & oXML.parseError.url)
Solar_PowerWH = 0
End If
TraceIt(4, "TED MTU Power Generated=" & CStr(Solar_PowerWH))
Script compile error: Type 'MSXML2.DOMDocument' is not defined.on line 215
Comment