# Different sounds based on alarm severity

**URL:** <https://forum.inductiveautomation.com/t/different-sounds-based-on-alarm-severity/6382>\
**Category:** Ignition\
**Created:** [May 3, 2013, 5:04pm UTC](https://forum.inductiveautomation.com/t/different-sounds-based-on-alarm-severity/6382 "2013-05-03T17:04:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry](https://avatars.discourse-cdn.com/v4/letter/h/df705f/32.png) [@Henry](https://forum.inductiveautomation.com/u/Henry)\
**Post date:** [May 3, 2013, 5:04pm UTC](https://forum.inductiveautomation.com/t/different-sounds-based-on-alarm-severity/6382/1 "2013-05-03T17:04:33Z")

</div>

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.

Thanks  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/026f2e7d0a4c8cf8946fc387aa49f2f244f95a08.jpg)

---

<div class="post-metadata">

**Author:** ![CPowell](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@CPowell](https://forum.inductiveautomation.com/u/CPowell)\
**Post date:** [May 3, 2013, 10:00pm UTC](https://forum.inductiveautomation.com/t/different-sounds-based-on-alarm-severity/6382/2 "2013-05-03T22:00:49Z")

</div>

Try using minSeverity=? and maxSeverity=? vice Severity.

EDIT:  
Sorry, was in a hurry. Let me clarify.  
Severity is not an option in system.alert.queryAlertStatus().

```auto
runScript("system.alert.queryAlertStatus(activeAndUnacked=1, minSeverity=2, maxSeverity=4).rowCount", 5000)
```

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 6, 2013, 1:05pm UTC](https://forum.inductiveautomation.com/t/different-sounds-based-on-alarm-severity/6382/3 "2013-05-06T13:05:55Z")

</div>

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])`
