How to Show a Button Only When an Active Alarm Occurs in Ignition

Hi everyone,

I'm trying to make a button visible only when there is an active alarm, and I'm using the system.alarm.queryStatus method for this. However, I'm having trouble getting the Visible property to recognize the expression. Is there another way to do this? I just want the button to be visible while there is an active alarm with a specific filter, for example:

if system.alarm.queryStatus(state=['Active'], displayPath="*BESS_1_1_1_1 : *"):
event.source.visible = True
else:
event.source.visible = False

Best regards.

What you're using seems to be a Script, you can test it on the console and with some prints you might be able to see if it's working, if it works on the console, then you might have a problem that the trigger you've set your script to might not be working, for example, if you placed it on a mouseClicked event and there isn't a click happening on the component.
Anyway, try adding a expression binding to the Visible property and use the isAlarmActive() function.
https://docs.inductiveautomation.com/display/DOC81/isAlarmActive
Also, is it vision or perspective?

1 Like

I was actually trying to do it through a script, but what I meant to ask was if there is a way to achieve the same thing using an expression. Sorry if I didn't explain myself clearly enough earlier.

and yees it's Vision properties that I'm working on.

On the other hand, isAlarmActive is exactly what I was looking for, in fact, the isAlarmActiveFiltered() method is even more useful for me. I really appreciate your response, greetings.

1 Like