system.alarm.queryStatus not working with more than 1 properties item

#1

I am trying to filter out the alarms (which there are 4 in totals) using associated data as shown in the below script:

props = [(“AlarmGroup”,"=",1),(“AlarmGroup”,"=",2)]
path = ['*Anyhow*']
state = [‘ActiveUnacked’]

print len(system.alarm.queryStatus(source = path,all_properties = [(“AlarmGroup”,"=",1)],state = state))
print len (system.alarm.queryStatus(source = path,all_properties = props,state = state))

If the all_properties = [(“AlarmGroup”,"=",1) is set, I am able to get 2 of the alarms. However, I would get 0 alarms if all_properties = props is used instead.

Any idea why is it so ?

0 Likes

#2

You need to use any_properties, not all_properties - you’re asking for alarms that have an AlarmGroup of both 1 and 2, simultaneously.
https://docs.inductiveautomation.com/display/DOC80/system.alarm.queryStatus

1 Like

#3

Thanks Paul. It is working now!

Btw, I think the below misleading caused my wrong usage (see the all_properties argument in the function):

Cheers!

0 Likes