Skip to main content
Version: V2 (Ignition 8.1)

system.mes.meter.getMeterTable

Description

Retrieves the meter hierarchy as a flat list of nodes spanning equipment and meter configurations, rooted either by location or by equipment class. Each node carries a hierarchyPath array (the path of titles from the root down to the node) and a parentId, so the original hierarchy can be reconstructed by the caller. This is the data that powers the Meter Table Perspective component.

The groupBy parameter controls how the tree is rooted. With the default "location", the tree runs Location → Equipment → Meter. With "equipmentClass", it runs Equipment Class → Equipment → Meter. In both modes meter configurations are injected beneath their equipment nodes.

By default the result is pruned to only those nodes that have at least one meter configuration somewhere in their subtree, together with the meter configuration nodes themselves. Set onlyWithMeters to False to return the complete hierarchy regardless of whether meters are attached.

Permissions

This method requires the METERING.READ.GET permission.

Syntax

system.mes.meter.getMeterTable([rootPath], [onlyWithMeters], [groupBy])

Parameters

ParameterTypeNullableDescription
rootPathStringTrueOptional path to scope the hierarchy. Interpreted as a location path when groupBy is "location", or an equipment-class path when groupBy is "equipmentClass". If omitted, the full hierarchy is returned.
onlyWithMetersBooleanTrueOptional. When True (the default), only nodes that have at least one meter configuration in their subtree are returned, along with the meter nodes. When False, the full hierarchy is returned.
groupByStringTrueOptional grouping mode. "location" (the default) roots the tree by Location → Equipment → Meter. "equipmentClass" roots the tree by Equipment Class → Equipment → Meter.

Returns

Returns a list of JSON objects representing the meter table nodes, in depth-first order. Each object has the following properties:

NameTypeDescription
idString (ULID)The ULID of the node (location, equipment, or meter configuration).
titleStringDisplay name of the node.
typeStringNode type discriminator: a location type enum name (e.g. SITE, AREA) or EQUIPMENT_CLASS (depending on the grouping mode), EQUIPMENT, EQUIPMENT_DISABLED, or METER_CONFIG.
hierarchyPathList[String]Path of titles from the root to this node.
parentIdString (ULID)The ULID of the parent node. Null for root nodes.
enabledBooleanIndicates if the node is enabled.
descriptionStringOptional description. Populated for METER_CONFIG nodes.
meterTypeNameStringName of the associated Meter Type. Non-null only for METER_CONFIG nodes.
maxRecordDurationSecondsIntegerMaximum record duration in seconds. Non-null only for METER_CONFIG nodes.
usageUnitOfMeasureSymbolStringSymbol of the usage unit of measure (e.g. kWh). Non-null only for METER_CONFIG nodes.

Code Examples

# Only locations/equipment that have meter configurations (default), across the whole hierarchy
nodes = system.mes.meter.getMeterTable()
for node in nodes:
print node['type'], node['title']

# Scope to a site and include the full hierarchy regardless of attached meters
allNodes = system.mes.meter.getMeterTable(rootPath='Enterprise/Site', onlyWithMeters=False)
print allNodes

# Group by equipment class (Equipment Class -> Equipment -> Meter) instead of by location
classNodes = system.mes.meter.getMeterTable(groupBy='equipmentClass')
for node in classNodes:
print node['type'], node['title']