Skip to main content
Version: V3 (Ignition 8.3)

system.mes.oee.getAlarmRecordsFiltered

Description​

Retrieves one detailed OEE Alarm Record per alarm that is linked to an OEE State Record, for the state records under a location path.

Each result (an OeeAlarmRecordDetailedDTO) carries the alarm, its parent state record, and that state record's root cause state record as nested OeeStateRecordDTO objects (the same shape as the OEE State Record), so tables and timelines can be built from a single call.

An alarm is included when its own active period overlaps the range: activeDate < endDate and (clearedDate is null or clearedDate > startDate). Alarms not linked to a state record, and alarms whose parent state record has a FAULTED status, are excluded.

Limits​

The call is rejected with an error when startDate is not before endDate, when the range is longer than oee.alarms.query.max_range_days (default 31 days), or when more than oee.alarms.query.max_rows (default 5000) alarm records match. Narrow the location or time range and retry. See the properties guide.

Permissions​

This method requires the OEE.READ.GET permission.

Syntax​

system.mes.oee.getAlarmRecordsFiltered(locationPath, startDate, endDate, eventTypes=None)

Parameters​

ParameterTypeNullableDescription
locationPathStringFalseThe path of the location to search. It is matched against the location of the parent state record, and includes the location subtree (Line1 matches Line1 and its children, not Line10). * is a wildcard; * alone matches all.
startDateDateFalseThe start of the time range.
endDateDateFalseThe end of the time range.
eventTypesString[]TrueParent state calculation types to include (for example DOWNTIME, BLOCKED, STARVED). Default is all.

Returns​

Returns a list of JSON objects, ordered by alarm activeDate descending. Each object is an OeeAlarmRecordDetailedDTO, which extends OeeAlarmRecordDTO: it carries every property of the standard alarm record (for example ignitionAlarmId, shelvedDate, lastEventState, oeeStateRecordId, oeeStateRecordCode, downtimeReasonCodeOverride, stateCodeOverride) in addition to the following properties:

NameTypeNullableDescription
idStringFalseThe id of the alarm record
nameStringFalseThe alarm name as configured in Ignition
labelStringFalseThe human-readable display name for the alarm
displayPathStringFalseThe hierarchical display path of the alarm
priorityStringTrueThe alarm priority (enum name)
stateStringFalseThe alarm state (enum name)
sourceStringFalseThe tag path or source that generated the alarm
activeDateInstantFalseWhen the alarm became active
clearedDateInstantTrueWhen the alarm cleared
acknowledgedDateInstantTrueWhen the alarm was acknowledged
durationMsLongTrueclearedDate minus activeDate in milliseconds, null while the alarm is still active
locationIdStringFalseId of the location the alarm was captured at
locationPathStringFalsePath of the location the alarm was captured at
isPrimarybooleanFalsetrue when this alarm is the primary alarm of the parent state record
stateRecordOeeStateRecordDTOFalseThe parent state record of the alarm. See OEE State Record for its properties (for example name, code, calculationType, color, startDate, endDate, locationId, locationName, locationPath, downtimeReason, interruptionLocationId, interruptionLocationName, interruptionLocationPath, rootCauseStateRecordId, primaryAlarmRecordId)
rootCauseStateRecordOeeStateRecordDTOTrueThe raw root cause state record of the parent state record, null when it has none. It is not substituted for DOWNTIME parents

Root resolution​

The "root" of an alarm row is not a separate property, derive it from the two nested records:

  • If stateRecord.calculationType is DOWNTIME, the state record is its own root: the root location is the state record's own location (stateRecord.locationId, locationName, locationPath) and the root state is stateRecord.
  • Otherwise the root location is the interruption location of the state record (stateRecord.interruptionLocationId, interruptionLocationName, interruptionLocationPath) and the root state is rootCauseStateRecord. Both are null when the state record has none.

Code Examples​

# All alarms in the last 8 hours under a line, for downtime and blocked states
end = system.date.now()
start = system.date.addHours(end, -8)
rows = system.mes.oee.getAlarmRecordsFiltered('Enterprise/Site/Area/Line1', start, end, eventTypes=['DOWNTIME', 'BLOCKED'])

for row in rows:
state = row['stateRecord']
if state['calculationType'] == 'DOWNTIME':
rootLocationPath = state['locationPath']
rootState = state
else:
rootLocationPath = state['interruptionLocationPath']
rootState = row['rootCauseStateRecord']
rootName = rootState['name'] if rootState else None
print row['label'], row['priority'], row['durationMs'], rootLocationPath, rootName