Skip to main content
Version: V3 (Ignition 8.3)

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:

nodeTypeWhat is returned
a location type (SITE, AREA, …)all meters on equipment currently at or under that location
UNASSIGNEDall meters on equipment with no location
EQUIPMENT / EQUIPMENT_DISABLEDthat equipment's meters
EQUIPMENT_CLASSall meters on equipment of that class and its sub-classes
METER_CONFIGjust 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

ParameterTypeNullableDescription
startDateDateFalseStart date (overlap window).
endDateDateFalseEnd date (overlap window).
nodeIdStringFalseThe Meter Table node id or path — a location, equipment, or equipment-class id/path, a meter-configuration id/name, or "UNASSIGNED".
nodeTypeStringFalseThe node's type discriminator (e.g. SITE, AREA, EQUIPMENT, EQUIPMENT_CLASS, METER_CONFIG, UNASSIGNED).
deselectedMeterIdsList[String]TrueOptional 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)