TMR Rest API Documentation
TMR Rest API Documentation
"itemNo": 26,
"obis": "1-0:0.0.1*255",
"attributeId": 2,
"decimalNumber": 0,
"dataType": "ASCII"
},
{
"itemName": "Total import active max demand",
"itemNo": 44,
"obis": "1-1:1.6.0*255",
"attributeId": 2,
"standardScaler": 0,
"standardUnit": "kW",
"decimalNumber": 4
},
{
"itemName": "Total Import Active Energy",
"itemNo": 49,
"obis": "1-1:1.8.0*255",
"attributeId": 2,
"standardScaler": 0,
"standardUnit": "kWh",
"decimalNumber": 4
},
…]
}
2. Device Information
Device information API provides the information for a certain meter or data concentrator,
such as the meter number, name, type, CT ratio, PT ratio, installation date etc.
Input format:
To get the information of one device:
/TMRDataService/deviceInfo/device?deviceNo=0101150001275
Or, to get the information of 500 devices:
/TMRDataService/deviceInfo/device?skip=0&take=500
Parameters:
The optional deviceNo parameter specifies the device identifier to return information on.
The optional skip and take parameters allows the pagination of device results. They specify
the start row number and maximum count of devices to return. For example, skip=0
&take=500 returns the first 500 devices. Note that both the default and the maximum
number of devices to return in one query is 500.
Output Example:
{
"pageInfo":
{
"endRowNum":10,
"startRowNum":1,
"totalRowNum":14
},
"data":
[{
"meterNo":"0060015051001",
"meterName":"Meter1500_0060015051001",
"meterType":"DLMS_METER",
"meterCt":"1.0/1.0",
"meterPt":"1.0/1.0",
"installationDate":"2015-07-17 17:01:53"
},
{
"meterNo":"14010028",
"meterName":"timingtasktest",
"meterType":"DLMS_METER",
"meterCt":"1.0/1.0",
"meterPt":"1.0/1.0",
"installationDate":"2015-08-11 15:35:52"
},
…
]
}
3. Billing Data
The billing data query returns the monthly billing data for the selected device on the
selected month.
Input Format:
/TMRDataService/billingData?deviceNo=873010080143&dataRecordMonth=2015-10
Parameters:
The required deviceNo parameter specifies the device number to get the billing data on.
The required dataRecordMonth parameter specifies which month to get the data for.
Output Example:
{
"data":
[{
"meterNo":"3299000000",
"meterName":"M7330CT123",
"dataRecordMonth":"2015-10",
"49":"3058",
"91":"0",
"137":"0",
"50":"0",
"51":"0",
"52":"0",
"92":"0",
"93":"0",
"94":"0",
"45":"0",
"46":"0",
"47":"0",
"87":"0",
"88":"0",
"89":"0",
"72":"0"
}]
}
The optional skip and take parameters allows the pagination of the results. They specify the
start row number and maximum count of records to return. The default maximum number
of records is 500.
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":52900},
"data":
[
{
"49": "171378",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:45:00"
},
{
"49": "171368",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:30:00"
},
{
"49": "171332",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:15:00"
},
{
"49": "171302",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 23:00:00"
},
{
"49": "171289",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:45:00"
},
{
"49": "171265",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:30:00"
},
{
"49": "171253",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:15:00"
},
{
"49": "171224",
"meterNo": "060014010040",
"meterName": "Meter0001",
"captureInterval":15,
"captureTime": "2014-06-30 22:00:00"
}]
}
5. Event Information
The event information query shows the details of the events, namely the event name, event
code.
Input format:
/TMRDataService/eventInfo/event
or
/TMRDataService/eventInfo/event?eventCode=1
Parameters:
The optional eventCode parameter specifies the event code to get the information on. If not
specified all the available events will be returned.
Example Output:
{
"pageInfo":
{
"endRowNum":110,
"startRowNum":1,
"totalRowNum":110
},
"data":
[ {
"eventCode": 63,
"eventName": "Over Voltage"
},
{
"eventCode": 59,
"eventName": "Over Current"
},
{
"eventCode": 102,
"eventName": "Voltage Loss"
},
…]
}
6. Event Data
The event record data provides the event record data for the specified device in the
specified date time range. (The result statusFlag: 1 means event start and 2 means event
end).
Input format:
/TMRDataService/eventData?deviceNo=0101150001275&eventCode=1&startTime=2015-01
-01 00:00:00&endTime=2015-07-01 00:00:00&skip=0&take=500
Parameters:
The optional deviceNo parameter specifies the device number to get the event data on.
The optional eventCode parameter specifies which events to return. If not specified, all the
available data events will be returned.
The optional startTime and endTime parameter specifies the start and end time of the
results. If not specified, all the data available from the very beginning will be returned.
The optional skip and take parameters allows the pagination of the results. They specify the
start row number and maximum count of records to return. The default maximum number
of records is 500.
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":1230},
"data":
[
{
"eventCode": "1",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag": 1
"captureTime": "2014-06-30 23:45:00"
},
{
"eventCode": "2",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag":2,
"captureTime": "2014-06-30 23:30:00"
},
{
"eventCode": "3",
"meterNo": "060014010040",
"meterName": "Meter0001",
"statusFlag":1,
7. Load Control
7.1. Disconnect/Reconnect
The API for load control to disconnect/reconnect the contactor of the meter. Because the
API requires interaction with the meter, and depending on the meter’s communication
operation mode, this could take anywhere from a few seconds to hours.
Therefore the API is asynchronous. The caller of the API invoke the command API, and gets
an UUID in the result. Then the caller of the API may query the command result via the
UUID.
Command API:
Input format:
/TMRDataService/load_control?deviceNo=060014010028&command=disconnect&schedule
=2016-12-01 00:00:00
Parameters:
deviceNo: required. Serial number of the target device.
command: required. Either disconnect or reconnect, case-ignored.
schedule: optional. Specifies the disconnect or reconnect schedule. Format is yyyy-MM-dd hh:mm:ss. If the
option is not specified, the command is executed immediately.
Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“uuid”: “89C3B4DE-05E5-4CFA-9916-B2985F41B08E”
}
Result API:
Input format:
/TMRDataService/load_control/op_result?uuid=89C3B4DE-05E5-4CFA-9916-B2985F41B08E
Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“statusCode”: 1000
}
Command API:
Input format:
/TMRDataService/relay_state?deviceNo=060014010028
Parameters:
deviceNo: required. Number of target device.
Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“uuid”: “63557BEC-C1C7-451A-A59A-3C844C8B37C9”
}
Result API:
Input format:
/TMRDataService/relay_state/op_result?uuid=63557BEC-C1C7-451A-A59A-3C844C8B37C9
Output example:
{
“meterNo”: “060014010028”,
“meterName”: “SAMPLE_METER_0028”,
“statusCode”: 1000,
“relayState”: “Disconnected”
}
Results:
relayState: Either Disconnected, Connected or Ready_for_reconnection.
You can use this function from tmr to configure the task to periodically
collect the current state of the meter’s relay.
For example, the below UI configures to read the relay status every 3 hours, and save that status to the
database.
Then you can use this API to query the relay status from the database. The API is synchronous and will not
need to wait for a communication result from the meter.
Command API:
/TMRDataService/relay_state_cached/query?skip=0&take=500
Example Output:
{
"pageInfo":
{
"endRowNum":500,
"startRowNum":1,
"totalRowNum":1230},
"data":
[
{
"meterNo": "343016056816",
"relayState": “Disconnected”,
"captureTime": "2014-06-30 23:45:00"
},
…
]
}
Command API :
/TMRDataService/relay_state_cached?deviceNo=343016056816
Example Output:
{
"meterNo": "343016056816",
"relayState": “Disconnected”,
"captureTime": "2014-06-30 23:45:00"
}
Command API:
Input format:
/TMRDataService/sendToken?deviceNo=0600140100281&token=41699982783217220077
Parameters:
deviceNo: Required. Number of target device.
token: Required. The token to send to meter.
Result API:
Example Output:
{
"meterNo":"0600140100281",
"meterName":"testem",
"uuid":”1129225f-8566-4b79-b990-0c5a554cacc1”
}
Error Codes
Error Codes
Code Description
1000 Success
1001 Parameter Error
1002 Parameter Missing Error
1003 No Result Error
1004 Database Error
1005 In Process
1006 Exceed Quota
2002 TOKEN rejected
2003 TOKEN expired
2004 TOKEN used
2005 Manufacture code error
2006 Key expired error
2007 DDTK error
2008 Charge amount overflow
2009 Key type Error
2010 Incorrect TOKEN data format
2011 Key range error
2012 Function not supported
2013 The first section key is accepted and OK
2014 The second section key is accepted and OK
2015 Lockout After 10 continuous rejections of token inputs, P2000 will lock out for one day (24
hours). During this period, any token entry will be rejected. After one day customers can input
tokens again.
Example Output:
{
"meterNo":"0600140100281",
“token”:41699982783217220077
“errorcode”:1000
}
Error Codes
Error Codes
Code Description
1000 Success
1001 Parameter Error
1002 Parameter Missing Error
1003 No Result Error
1004 Database Error
1006 Exceed Quota