system.mes.meter.getMeterRecordsForBranch
Description
Retrieves the Meter Records for a single selected branch of the Meter Table hierarchy, excluding any de-selected meters. This powers the selection-driven charts on the Meter Usage Dashboard: rather than enumerating every selected meter, the dashboard passes one branch (e.g. a whole location or equipment) plus the small set of meters that were un-checked under it.
The branch is identified by a node id and type:
nodeType | What is returned |
|---|---|
a location type (SITE, AREA, …) | all meters on equipment currently at or under that location |
UNASSIGNED | all meters on equipment with no location |
EQUIPMENT / EQUIPMENT_DISABLED | that equipment's meters |
EQUIPMENT_CLASS | all meters on equipment of that class and its sub-classes |
METER_CONFIG | just that one meter |
Scoping keys off the equipment's current location/path, not the record's historical location snapshot, so results stay correct after equipment is moved between locations.
Permissions
This method requires the METERING.READ.GET permission.
Syntax
system.mes.meter.getMeterRecordsForBranch(startDate, endDate, nodeId, nodeType, [deselectedMeterIds])
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
startDate | Date | False | Start date (overlap window). |
endDate | Date | False | End date (overlap window). |
nodeId | String | False | The Meter Table node id or path — a location, equipment, or equipment-class id/path, a meter-configuration id/name, or "UNASSIGNED". |
nodeType | String | False | The node's type discriminator (e.g. SITE, AREA, EQUIPMENT, EQUIPMENT_CLASS, METER_CONFIG, UNASSIGNED). |
deselectedMeterIds | List[String] | True | Optional meter configuration ids under the branch to exclude. |
Returns
Returns a list of JSON objects representing the matching Meter Records for the branch (same shape as getMeterRecords).
Code Examples
from java.util import Date
end = Date()
start = Date(end.getTime() - 3600000) # last hour
# All meters under a site, except two that were de-selected in the Meter Table
records = system.mes.meter.getMeterRecordsForBranch(
startDate=start, endDate=end,
nodeId='Enterprise/Site', nodeType='SITE',
deselectedMeterIds=['01J9YP3JBR-WQ8GWRR2-8Y879V2D'])
# Every meter on one equipment
records = system.mes.meter.getMeterRecordsForBranch(
startDate=start, endDate=end, nodeId=equipmentId, nodeType='EQUIPMENT')
print len(records)