I am currently developing a system in which management can respond to alarm events via sms through a Twilio server. The functionality that I am trying to acheive is that the alarm is triggered, sends a notification to the manager, the manager then has the option to respond to the notification. If the manager responds, an acknowledge pipeline is triggered. The acknowledge pipeline then contains logic that saves the value that triggered the alarm as well as other associated data to a custom database table.
Now this works fine until I run into the situation where the tag that triggered the alarm clears it’s alarm state. Inside the acknowledge pipeline I am using the event['eventValue'] property to get the value of the tag that triggered the alarm. The Ignition manual seemed to indicate that this property was the value that triggered the alarm, but it keeps returning the current value. I am assuming that this is just a misunderstanding of the documentation on my end. However, is there a way to get the value that triggered the alarm in the acknowledge pipeline, even after the alarm event has been cleared?
After a good amount of investigation, it does not appear that there is currently a documented way to obtain the initial “active” alarm value from an acknowledge pipeline. This definitely seems like it should be possible since when looking at the alarm status table, the active event value is still retained in the alarm information even after the alarm is cleared and acknowledged.
I was able to create a workaround for this though. It appears that there is an undocumented dictionary value on the alarm pipeline for the database alarm UUID:
Using this I was able to generate a query that allowed me to retrieve the active value from my acknowledge pipeline as follows:
FROM alarm_event_data aed
JOIN alarm_events ae ON ae.id = aed.id
WHERE ae.eventtype = 0
AND aed.propname = 'eventValue'
AND ae.eventid =?
As I mentioned before, it does seem like this data should be easier to get. If anyone from inductive knows anything about this that I have not been able to discover I would be very curious.
In the pipline script block? I’ve tried calling the alarm property functions on that object but always get an error? I just tried what you suggested and also got an error. It seems like that event object being passed in is not actually the same type of alarm event object that would be generated by something like system.alarm.queryStatus() which you then could run the additional alarm methods against unless I am missing something here?
So I can get the active data by use of activeEvent = event.sourceEvent.getActiveData() but I cannot seem to then pull any of the associated property data out of the event object. The documenation states that I should be able to use get(String propertyName) on this object but when I use activeEvent.get('eventValue') I get an error stating:
1st arg can't be coerced to com.inductiveautomation.ignition.common.config.Property
If I run activeEvent.getProperties() however, I do receive back a list of property names of which “eventValue” is one of them. Do I somehow need to use an actual property “type” as an insert into the get function instead of the string name and if so how would I do that?