How do I perform an XML poll of data from my datalogger?

sdo

Member
To poll our dataloggers for current readings via HTTP or HTTPS, the following two URL examples will assist you with generating the request.


The following is the equivalent data you would get when viewing the Devices > Device List area of the web interface of the datalogger. When utilizing the example URL, the following XML code is an example of what you might receive-

Where
  • username = login username to the logger
  • password = login passsword to that username
  • 192.168.40.50 = the IP address to the logger

XML:
<ModbusStats>
<numdevices>11</numdevices>
<numPort502devices>11</numPort502devices>
<numPort502Errdevices>0</numPort502Errdevices>
<devices>
<device address="2" parentaddress="0" name="UNIT 28TH FLR" status="Ok" type="LDN28.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="433" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="45" nStatus="1" nDevError="0" strDevErr="Success" nPoints="32"/>
<device address="3" parentaddress="0" name="UNIT 27TH FLR" status="Ok" type="LDN27.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="49" nStatus="1" nDevError="0" strDevErr="Success" nPoints="32"/>
<device address="4" parentaddress="0" name="UNIT 26TH FLR" status="Ok" type="LDN26.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="44" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="5" parentaddress="0" name="UNIT 25TH FLR" status="Ok" type="LDN25.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="46" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="6" parentaddress="0" name="UNIT 24TH FLR" status="Ok" type="LDN24.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="45" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="7" parentaddress="0" name="UNIT 23rd FLR" status="Ok" type="LDN23.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="46" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="8" parentaddress="0" name="UNIT 22nd FLR" status="Ok" type="LDN22.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="45" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="9" parentaddress="0" name="UNIT 21ST FLR" status="Ok" type="LDN21.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="45" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="10" parentaddress="0" name="UNIT 20TH FLR" status="Ok" type="LDN20.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="46" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="11" parentaddress="0" name="UNIT 19TH FLR" status="Ok" type="LDN19.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="46" nStatus="1" nDevError="0" strDevErr="Success" nPoints="40"/>
<device address="12" parentaddress="0" name="UNIT 18TH FLR" status="Ok" type="LDN18.mbt" serial="" firmware="" devclass="4000" nPort="502" comparam="19200n81" pktsent="432" pktreceived="432" pkterror="0" pktsuccessrate="100" pktrtt="46" nStatus="1" nDevError="0" strDevErr="Success" nPoints="10"/>
</devices>
<strDevListErr/>
</ModbusStats>



From the address field returned in the above XML data, it is then possible to request data from a given device and filling in the address parameter in the following URL:
Where
  • ADDRESS= should be the device number from the previous example. You do not need to include leading zeros.
This would be similar to the data that you would see by clicking into a given device from the web interface of the logger from Devices > Device List.

XML:
<DAS>
<name>EMH Datalogger Name</name>
<serial>001EC6xxxxxx</serial>
<devices>
<device>
<name>UNIT 18TH FLR</name>
<address>12</address>
<type>LDN18.mbt</type>
<class>4000</class>
<status>Ok</status>
<numpoints>10</numpoints>
<records>
<record>
<time zone="UTC">2025-03-20 15:00:15</time>
<age units="seconds">4</age>
<error text="Ok">0</error>
<point number="0" name="APT 8531 kwh" units="kWh" value="62458.067"/>
<point number="1" name="APT 1942 kwh" units="kWh" value="4863.641"/>
<point number="2" name="APT 7268 kwh" units="kWh" value="26789.963"/>
<point number="3" name="APT 3847 kwh" units="kWh" value="43196.983"/>
<point number="4" name="APT 5710 kwh" units="kWh" value="52753.842"/>
<point number="5" name="APT 2683 kwh" units="kWh" value="85464.145"/>
<point number="6" name="APT 1492 kwh" units="kWh" value="34954.272"/>
<point number="7" name="APT 8763 kwh" units="kWh" value="28980.582"/>
<point number="8" name="APT 9825 kwh" units="kWh" value="28755.591"/>
<point number="9" name="APT 4563 kwh" units="kWh" value="39083.800"/>
</record>
</records>
</device>
</devices>
</DAS>

Note that this is just one example of the type of datapoints and column structure from a device. Depending on the device make & model, and the mapping used to read the datapoints from it, you can expect there as many as 1023 datapoints, with any engineering unit types.

The age will indicate when that data was last captured. By default these are updated based on the logging interval configured in the device. By accessing this URL, our logger will repoll for the latest data. Depending on the latency to complete this action, it is possible to access the URL once again to retrieve a newer set of readings.
 
Last edited:
Back
Top