system.alarm.queryStatus filter by UUID

Hi there,
I’m trying to grab the extended alarm event data from a custom table component row click to drive an alarm detail popup. I have the UUID of the alarm event in the table, and have tried to grab the underlying event data with:

myUUID = '841c505f-2312-4ee0-ab9b-334fea253e85'
results = system.alarm.queryStatus(all_properties=[('UUID', '=', myUUID)])

but the above returns no results. I also tried converting the string representation of the alarm id to a UUID object before the query:

from java.util import UUID
myUUID = '841c505f-2312-4ee0-ab9b-334fea253e85'
myUUID = UUID.fromString(myUUID)
results = system.alarm.queryStatus(all_properties=[('UUID', '=', myUUID)])

I know I can do a wider query and iterate over the results to find the result that matches the clicked alarm id, but that seems really inefficient. Is there another way to do this, or get a single query result that matches a single alarm event?

A more attentive reading of the manual for this function shows that the any_properties and all_properties keywords are only for associated data. (at least according to code snippet comments)

It appears that using the full source property of the alarm event like so:

mySource = 'prov:<myProvider>:/tag:<myTagPath>:/alm:<myAlarmName>'
results = system.alarm.queryStatus(source=[mySource])

does the trick of returning a single result matching the desired alarm event data.

Glad to hear you got it working. For posterity, in your first example, you could replace “UUID” with “EventId”

myUUID = '841c505f-2312-4ee0-ab9b-334fea253e85'
results = system.alarm.queryStatus(all_properties=[('EventId', '=', myUUID)])

I think the problem is that the all_properties and any_properties filters were looking for specific keys that aren’t listed in the docs. I’ll figure out what those are and get them added to the documentation.

1 Like

Thanks Paul - this is cleaner than my workaround, and having the any/all_properties keys documented would be nice to have.