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
| Parameter | Type | Nullable | Description |
|---|---|---|---|
rootPath | String | True | Optional 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. |
onlyWithMeters | Boolean | True | Optional. 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. |
groupBy | String | True | Optional 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:
| Name | Type | Description |
|---|---|---|
id | String (ULID) | The ULID of the node (location, equipment, or meter configuration). |
title | String | Display name of the node. |
type | String | Node 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. |
hierarchyPath | List[String] | Path of titles from the root to this node. |
parentId | String (ULID) | The ULID of the parent node. Null for root nodes. |
enabled | Boolean | Indicates if the node is enabled. |
description | String | Optional description. Populated for METER_CONFIG nodes. |
meterTypeName | String | Name of the associated Meter Type. Non-null only for METER_CONFIG nodes. |
maxRecordDurationSeconds | Integer | Maximum record duration in seconds. Non-null only for METER_CONFIG nodes. |
usageUnitOfMeasureSymbol | String | Symbol 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']