Skip to main content

10. Alarm Service

Accessed via client.alarm(). It provides two functions: single-record and recent lookup of alarm events. If you need detailed statistics or alarm configuration (Config) CRUD, use the data gateway directly.

9.1 Method List

MethodReturn TypeHTTPEndpoint
get(alarm_seq)AlarmResponseV5 or nullGET/api/v5/alarm/{seq}
list(limit)List<AlarmResponseV5>GET/api/v5/alarm?limit=...

limit ≤ 1000 is recommended. If you need more data, it is better to query the data gateway directly.

9.2 AlarmResponseV5 DTO

Includes the alarm body plus the JOIN results for location (tag/opc/site).

Alarm Body Fields

FieldTypeDescription
alarm_seqlongAlarm sequence (PK)
alarm_config_idStringAlarm configuration ID
priorityStringPriority (HI_HI, HI, LO, LO_LO, TRIP)
descriptionStringAlarm message
is_onStringCurrently active or not (Y/N)
is_readStringRead or not (Y/N)
on_timestamplongOccurrence time (milliseconds)
off_timestamplongClear time (0 = not cleared)
on_durationlongDuration (milliseconds)

Location JOIN Fields (included in the list response)

FieldDescription
tag_id, tag_name, tag_descriptionTag information
opc_id, opc_nameOPC information
site_id, site_nameSite information
tag_locationAsset path string (SITE > AREA > LINE > EQUIPMENT)

In the single-record get() response, only the mm_alarm body is populated, and the JOIN fields are often null. For UI display, using the list() result is recommended.

9.3 Alarm Priorities

CodeMeaningTypical Color
HI_HICriticalRed
HIWarningOrange
LOInfoYellow
LO_LORecoveryBlue
TRIPTrip (forced shutdown)Black

9.4 Usage Examples

Recent Alarm List

import java.util.List;
import plantpulse.api.v5.dto.response.AlarmResponseV5;

List<AlarmResponseV5> alarms = client.alarm().list(50);
for (AlarmResponseV5 a : alarms) {
System.out.printf("[%s] %s - %s (%s)%n",
a.getPriority(),
a.getSite_name(),
a.getDescription(),
a.getTag_location());
}

Example output:

[HI_HI] 대전공장 - Spindle 온도 임계치 초과 (SITE_DJ > A_0001 > L_0001 > CNC #1)
[HI] 대전공장 - 압력 상한 (SITE_DJ > A_0001 > L_0001 > Press #2)

Single-Record Lookup

AlarmResponseV5 alarm = client.alarm().get(12345L);
if (alarm != null) {
System.out.println("발생 시각: " + alarm.getOn_timestamp());
System.out.println("우선순위: " + alarm.getPriority());
System.out.println("지속 시간: " + alarm.getOn_duration() + " ms");
}

Filtering Active Alarms Only (Client Side)

V5 does not support server-side active filtering, so handle it on the client.

import java.util.stream.Collectors;

List<AlarmResponseV5> active = client.alarm().list(500).stream()
.filter(a -> "Y".equals(a.getIs_on()))
.collect(Collectors.toList());

System.out.println("현재 활성 알람: " + active.size() + "건");

Grouping by Site

import java.util.Map;
import java.util.stream.Collectors;

Map<String, Long> bySite = client.alarm().list(1000).stream()
.filter(a -> "Y".equals(a.getIs_on()))
.collect(Collectors.groupingBy(
AlarmResponseV5::getSite_id,
Collectors.counting()));

bySite.forEach((siteId, count) ->
System.out.printf("%s: %d건%n", siteId, count));

Count by Priority

Map<String, Long> byPriority = client.alarm().list(1000).stream()
.collect(Collectors.groupingBy(
AlarmResponseV5::getPriority,
Collectors.counting()));

9.5 Application Scenarios

Scenario — Real-Time Alarm Dashboard

while (running) {
List<AlarmResponseV5> alarms = client.alarm().list(100);

long critical = alarms.stream()
.filter(a -> "Y".equals(a.getIs_on()))
.filter(a -> "HI_HI".equals(a.getPriority()))
.count();

updateDashboard(alarms, critical);
Thread.sleep(1_000);
}

Scenario — Alarms from a Specific Asset Line Only

String targetLine = "SITE_DJ > A_0001 > L_0001";

List<AlarmResponseV5> lineAlarms = client.alarm().list(500).stream()
.filter(a -> a.getTag_location() != null
&& a.getTag_location().startsWith(targetLine))
.collect(Collectors.toList());

Next Steps

  • Tag Service — set alarm thresholds with patchAlarm
  • Path Service — tree path of the asset where the alarm occurred