Get name out of an active alarm

I am trying the build a new project. I want to create an alarm board. I have many different kind of sensors that all have different alarm. I want to be able to send a pop-up window with a background color according to the urgency of the alarm and I also want a good alarm description in this window.

Because of the huge amount of different alarms I want to create a good solution. I want to retrieve the name and description of the active alarm and put it inside two variables. That way I want to make a label where those variables are used. For example: "{AlarmName} active, {AlarmDescription}".

I still cant find out how I can get the info out of an alarm and put it in a variable. Does somebody know how to do this?

Alarms configured on tags have a lot of properties available, the priority is a built-in property and a description could exist in one of several different string properties on an alarm.

When alarms are active, they are available through the scripting function:

You can test with this script to try and extract the data you're looking for. There are examples at the bottom, then if you read about the returned objects from this script function you will identify how to fetch specific info you want. The returned objects are explained in this section of the UM page:

Returns

AlarmQueryResult - The AlarmQueryResult object is a list of PyAlarmEvent objects with some additional helper methods, see Scripting Object Reference.

Additionally, each PyAlarmEvent inside of the AlarmQueryResult object has several built-in methods to extract alarm information. More details on these methods can be found on the Scripting Object Reference page.

Would the alarm status table not suffice for what you're after? it sounds exactly what you're describing.

fwiw, I use the alarms fields like this:
name: non-contextual name of the alarm e.g. "Failed to Close"
label: description and equipment label of the device e.g. "Coolant Pump [C001_PU01]"
displayPath: functional area where the device is part of e.g. "Pkg Filtration"

Then you have the ability to display different combinations of these depending on where the alarms are being shown:
Device popups: name only
Parent device popups (e.g. a tank popup that contains a temperature probe within it): label and name
General alarm page: displayPath (area), label (device), and name

However I also rename these names using the translation manager, renaming "Label" to "Device" and "Display Path" to "Area"

4 Likes