I have a query that plays a sound on a new alarm and it works great.
alerts = system.alert.queryAlertStatus(activeAndUnacked=1)
print alerts.rowCount
if alerts.rowCount > 0:
system.util.execute([“C:\sndrec32”, “/play”, “/close”, “/embedding”, “c:\alarm.wav”])
I would like to modify it so that I can play different sounds based on alarm severity. I have created 3 test tags with different alarm severities and six queries. The queries are Active and Severity =4, Active and Severity =3, Active and Severity =2, Severity =4, Severity =3 and Severity =2. The problem is that result is the same number from all six queries and I don’t see my mistake.
Here’s a snippet for counting the number of each severity level. you can then call whatever sound you want judging on the values in Severity[0] through Severity[4]
Severity={}
for x in range(5):
Severity[x]=0
Levels = {"Low":0,
"Medium-low":1,
"Medium":2,
"Medium-high":3,
"High":4}
alerts = system.dataset.toPyDataSet(system.alert.queryAlertStatus(activeAndUnacked=1))
for row in alerts:
Severity[Levels[row["Severity"]]]+=1
for x in range(5):
print "Severity["+str(x)+"]="+str(Severity[x])