Author Topic: TED Pro XML reading  (Read 223 times)

Pnord

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
TED Pro XML reading
« on: June 07, 2018, 06:34:28 AM »
Hi,
I've been searching here for some time & have found much useful info, BUT.
I can't figure this one out.
I have a VB script running in Homeseer reading the TED XML values.

For the MTU:
    TEDAddress = TEDURL & "/history/export.xml?D=0&M=0&C=1&T=3"
    TEDXML.Load(TEDAddress)
    TEDNode = TEDXml.SelectSingleNode("HISTORY/HOUR/POWER").InnerText

and similarly for the Spyders i = 1 to 16:
        TEDAddress = TedURL & "/history/export.xml?D=1&M=" & i & "&C=1&T=2"
        TEDXML.Load(TEDAddress)
        TEDNode = TEDXml.SelectSingleNode("HISTORY/HOUR/POWER").InnerText

The above works great !!!! For HOUR data. I want minute data.

    I should (in my mind) be able to adjust the T= parameter down one to T=2(MTU) or T=1 for spyder, change the "HOUR" to "MINUTE"
    in the XML read and have that work also, NOPE!. I've tried several combinations and the above HOUR script is the only
    combo that I can make work. The XML tree structure seems the same for any T=  except the <HOUR> changes to <SECOND>,
    <MINUTE> etc.
Whats the trick?
Thanks
Paul


pfletch101

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
    • My home page
Re: TED Pro XML reading
« Reply #1 on: June 07, 2018, 10:53:17 AM »
I would agree that what you are doing should produce the results you expect. I just wonder if the TEDXML.Load() function is doing something to the parameters passed to it. I don't think that this is a TED problem, and you may want to repost your question in a Homeseer support forum.
Peter R. Fletcher
TED Pro Home - main MTUs monitoring utility and PV Solar feeds; 2 Spyders monitoring selected individual circuits

Support7

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
  • Karma: +1/-0
Re: TED Pro XML reading
« Reply #2 on: June 08, 2018, 09:09:39 AM »
You may want to check the API again or if you haven't gotten the API then you can request it by submitting a support ticket. I've copy/pasted the correct parameters for the history export from the API below.

For minute data you would specify T2 and the D parameter sets the device type as MTU or Spyder.

File: /history/export.xml
Description: Exports history in xml format.
Parameters:
T: History Type (1=Second, 2=Minute, 3=Day, 4=Hour, 5=Month)
D: Device Type. 0=MTU 1=Spyder
M: The 1-based index of the MTU or Spyder being displayed.
C: Count (optional): Number of records to return (starting with the most recent)
I: Index (optional): Number of records to offset (starting from the most recent)
S: start time (optional): Allows you to specify a date range of which to return records. Time is
specified in epoch time format.
E: end time (optional): Allows you to specify a date range of which to return records. Time is
specified in epoch time format.

Example (Returns the second history information for MTU #1):
http://192.168.1.7/history/export.xml?D=0&M=1&T=1

For troubleshooting or if you run into any questions please let us know by going to http://www.theenergydetective.com/ticket and fill in the requested information to submit a support ticket so we can work to resolve any issues that may arise ASAP and make sure we provide the right firmware for any updates requested or required.

pfletch101

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
    • My home page
Re: TED Pro XML reading
« Reply #3 on: June 08, 2018, 10:03:46 AM »
You may want to check the API again or if you haven't gotten the API then you can request it by submitting a support ticket. I've copy/pasted the correct parameters for the history export from the API below.

For minute data you would specify T2 and the D parameter sets the device type as MTU or Spyder.



You are correctly quoting the API documentation on the T parameter here, but the OP is correct (and the documentation wrong!) that the T parameter meanings are shifted by 1 between Spyder and MTU data download calls. See the thread about the API I started in 2014 (http://forum.theenergydetective.com/index.php/topic,2953.0.html).
Peter R. Fletcher
TED Pro Home - main MTUs monitoring utility and PV Solar feeds; 2 Spyders monitoring selected individual circuits

Support7

  • Administrator
  • Sr. Member
  • *****
  • Posts: 464
  • Karma: +1/-0
Re: TED Pro XML reading
« Reply #4 on: June 08, 2018, 03:06:56 PM »
This is the first I've been made aware of the fault in the API so I have put in a request to have the documentation corrected.

Corrected "T" Parameters:
MTU T:
1=Second
2=Minute
3=Hour
4=day
5=Month

Spyder T:
1=minute
2=hour
3=day
4=month

Example:
192.168.7.4/history/export.xml?D=1&M=1&T=1 returns Spyder Minute data

I'm self taught and only program as a hobby so I'm sure you guys know more than I do but changing the T parameter to 1 worked successfully for me in the above example and I ran line 1 for the Spyder (TEDAddress = TedURL & "/history/export.xml?D=1&M=" & i & "&C=1&T=1") of OP's command string(changing T=2 to T=1) against my system and successfully retrieved minute data so maybe something else in the script is in conflict as pfletch101 suggests but would be beyond my ability to confirm.