I am needing to create alarms via multiple modules that we are developing for our Ignition projects. Thus far, I have been able to add a journal entry to the Alarm Journal from the module’s Gateway Context and the alarm reports back in the module that it is Active, Unacknowledged. However, that alarm doesn’t show up as a System alarm in the Alarm Journal or the System’s Gateway alarm tags.
What am I missing?
Get GatewayContext.getAlarmJournal
Create AlarmEvent and EventData
Call AlarmEvent.active(EventData)
Call AlarmJournal.storeEvent(AlarmEvent)
I may have messed up some of the PseudoCode, but any help would be appreciated.
If you want it to be a system event, then you just set com.inductiveautomation.ignition.common.alarming.config.CommonAlarmProperties#IsSystemEvent on the property set.
I tried the following code and setting isSystemFlag didn’t seem to do much either. It is possible I used it incorrectly because I am not sure where I was supposed to set that property value.
This is the one generated from the script above. However, the System tag for Active, Unacknowledged alarms does not change values ([System]Gateway/Alarming/Active and Unacked).
This alarm is from a tag generated alarm we have configured in one of our UDTs. It seems like I am missing something to tell the gateway there is a new active alarm.
Still trying to work through this based on the SDK Programmer Guide and the JavaDocs, but struggling with a few things.
The SDK guide says
Most alarms in Ignition are defined on tags. However, it is possible for modules to generate their own alarms. All alarm evaluation is handled by the AlarmManager, you simply give it the definition of an alarm through AlarmManager.registerAlarm(...), and it provides you with an AlarmEvaluator that you update from time to time with the current value.
However, registerAlarm takes 4 parameters, and we're not sure how to construct them to raise a simple alarm.
Registers the configuration of an alarm for a specific source, also providing the context for references in bound alarm properties. The result is an AlarmEvaluator which will be used by the source to evaluate values. When the source is done or removed, it should release the AlarmExecutor to unregister it from the system.
So let's say we want to raise a simple alarm that shows the user that a bad thing happened whenever we encounter a condition (hypothetically, we can use as an example, an exception is encountered during a critical operation).
What would we need need to pass in as a QualifiedPath, PropertyValueSource and ExpressionParseContext when we're wanting to raise the alarm on something in memory instead of on a tag?
Once we have an AlarmEvaluator, how do we update it from time to time?
I don’t think what you’re ultimately looking for is currently possible. registerAlarm is going to give you back an object that you can manually provide specific values to, and then based on the supplied alarm configuration, the AlarmEvaluator will choose whether or not it’s going to actually trigger an alarm. It’s not a true ‘fire off an alarm using the rest of the subsystem’ mechanism.