system.mes.meter.getMeterRecords
Description
Retrieves Meter Records within a date range with optional filters. Two calling conventions are supported: positional arguments and keyword arguments. The keyword form accepts meterIdOrName in place of recordName.
Permissions
This method requires the METERING.READ.GET permission.
Syntax
# Positional arguments
system.mes.meter.getMeterRecords(startDate, endDate, equipmentIdOrPath, locationIdOrPath, meterTypeIdOrName, recordName, statuses)
# Keyword arguments
system.mes.meter.getMeterRecords(startDate=startDate, endDate=endDate, equipmentIdOrPath=equipmentIdOrPath, locationIdOrPath=locationIdOrPath, meterTypeIdOrName=meterTypeIdOrName, meterIdOrName=meterIdOrName, statuses=statuses)
Parameters
Positional arguments:
| Parameter | Type | Nullable | Description |
|---|---|---|---|
startDate | Date | False | Start of the date range to query. |
endDate | Date | False | End of the date range to query. |
equipmentIdOrPath | String | True | Filter by equipment ID or path. |
locationIdOrPath | String | True | Filter by location ID or path. |
meterTypeIdOrName | String | True | Filter by meter type ID or name. |
recordName | String | True | Filter by meter record name. |
statuses | List<String> | True | Filter by status values (e.g., ['RUNNING', 'COMPLETED']). |
Keyword arguments:
| Parameter | Type | Nullable | Description |
|---|---|---|---|
startDate | Date | False | Start of the date range to query. |
endDate | Date | False | End of the date range to query. |
equipmentIdOrPath | String | True | Filter by equipment ID or path. |
locationIdOrPath | String | True | Filter by location ID or path. |
meterTypeIdOrName | String | True | Filter by meter type ID or name. |
meterIdOrName | String | True | Filter by meter record ID or name. |
statuses | List<String> | True | Filter by status values (e.g., ['RUNNING', 'COMPLETED']). |
Returns
Returns a list of JSON objects representing the matching Meter Records. Each object in the list has the same properties as those returned by getMeterRecord.
Code Examples
# Retrieve completed Meter Records for the past 7 days on a specific equipment
startDate = system.date.addDays(system.date.now(), -7)
endDate = system.date.now()
meterRecords = system.mes.meter.getMeterRecords(
startDate=startDate,
endDate=endDate,
equipmentIdOrPath='Enterprise/Site/Line1',
statuses=['COMPLETED']
)
# Output the Meter Records
print(meterRecords)