Skip to main content
Version: V3 (Ignition 8.3)

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:

ParameterTypeNullableDescription
startDateDateFalseStart of the date range to query.
endDateDateFalseEnd of the date range to query.
equipmentIdOrPathStringTrueFilter by equipment ID or path.
locationIdOrPathStringTrueFilter by location ID or path.
meterTypeIdOrNameStringTrueFilter by meter type ID or name.
recordNameStringTrueFilter by meter record name.
statusesList<String>TrueFilter by status values (e.g., ['RUNNING', 'COMPLETED']).

Keyword arguments:

ParameterTypeNullableDescription
startDateDateFalseStart of the date range to query.
endDateDateFalseEnd of the date range to query.
equipmentIdOrPathStringTrueFilter by equipment ID or path.
locationIdOrPathStringTrueFilter by location ID or path.
meterTypeIdOrNameStringTrueFilter by meter type ID or name.
meterIdOrNameStringTrueFilter by meter record ID or name.
statusesList<String>TrueFilter 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)