Alarm Acknowledge Button

I need to make a button in my application that when pressed (on release) it acknowledges all unacknowledged alarms.

This button would reside on the screen containing my alarm table.

I was unable to locate any examples in the forums of code that worked for this that didn’t generate errors.

no

# Query alarm status. This example grabs all alarms that are unacked.
data = system.alarm.queryStatus(status = ['ActiveUnacked', 'ClearUnacked'])
# Create list of event IDs
uuidList = [str(row.getId()) for row in data]
# Acknowledge alarm list. 
system.alarm.acknowledge(uuidList)

Thanks for the info! I’ll try it out when I get back from site later this week and let you know how it goes.

1 Like

Well note quite there yet. When I press the button I get this error

Traceback (most recent call last):
File “event:mouseReleased”, line 5, in
TypeError: acknowledge(): expected 2 args; got 1

at org.python.core.Py.TypeError(Py.java:265)
at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:211)
at org.python.core.PyReflectedFunction.throwArgCountError(PyReflectedFunction.java:264)
at org.python.core.PyReflectedFunction.throwError(PyReflectedFunction.java:321)
at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:169)
at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction.__call__(ScriptManager.java:524)
at org.python.core.PyObject.__call__(PyObject.java:480)
at org.python.core.PyObject.__call__(PyObject.java:484)
at org.python.pycode._pyx25.f$0(<event:mouseReleased>:5)
at org.python.pycode._pyx25.call_function(<event:mouseReleased>)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:782)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:206)
at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:297)
at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:57)
at com.sun.proxy.$Proxy58.mouseReleased(Unknown Source)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.0.14 (b2020062220)
Java: Azul Systems, Inc. 11.0.6

Try system.alarm.acknowledge(uuidList, None )

Odd, as I had tested it on 8.0.13, but trying again throws the error.

Using None for the notes parameter does work. According to the manual, though, it’s supposed to be optional.

Client vs Gateway scope. OP didn’t specify Vision or Perspective so based on the error I assume they invoked this event via Perspective. The gateway scope of this function requires the notes.

https://docs.inductiveautomation.com/display/DOC80/system.alarm.acknowledge

Hey that makes it functional. I will play with it a bit more to see if I can break it but hopefully this has got me covered. Thanks to both of you guys this has been so helpful!

Yeah, but it throws the error in the Script Console. Plus, you would also need the username parameter in the gateway scope.

As far as I can tell the notes parameter has always been required and the manual is incorrect to state that it’s optional, rather than stating that it can be None.

That is odd. The username is optional in the gateway scope which seems strange too.

Seems the username is recommended to be omitted via Client scope.

Thanks, Kevin. Not sure what I did to make it work the first time, then. Luck of the old man, I guess.

Whose auspices does the manual fall under?

I pinged @Paul.Scott about it. Whether he’s still the right person I’m not actually sure :sweat_smile:

If it’s not right, we’ll always think it should have been.

Thanks for the report gang. I’ll take care of the user manual.

2 Likes