# Latched Alarm Condition

**URL:** <https://forum.inductiveautomation.com/t/latched-alarm-condition/2855>\
**Category:** Ignition\
**Created:** [April 12, 2011, 12:45pm UTC](https://forum.inductiveautomation.com/t/latched-alarm-condition/2855 "2011-04-12T12:45:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dodonnell999](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@Dodonnell999](https://forum.inductiveautomation.com/u/Dodonnell999)\
**Post date:** [April 12, 2011, 12:45pm UTC](https://forum.inductiveautomation.com/t/latched-alarm-condition/2855/1 "2011-04-12T12:45:28Z")

</div>

I am trying to create a latched alarm with the following behaviour  
When a Float value is below a setpoint the alarm will latch on,  
when the float value returns above the setpoint the alarm with remain on until a reset button is pressed by the user.

I have a fairly clumsy way of doing this with 3 tags per alarm, ie. a boolean alarm condition tag, a boolean alarm tag and a boolean reset tag. The alarm tag has the following expression behind it

switch({[.]AlarmCondition},1,1,  
switch({[.]AlarmReset}, 1 , 0 , {[.]Alarm}))

I was just wondering if anyone could see a simpler way of achieving this ( with less tags required )?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [April 12, 2011, 3:04pm UTC](https://forum.inductiveautomation.com/t/latched-alarm-condition/2855/2 "2011-04-12T15:04:11Z")

</div>

You could get away with just one tag that you set and reset through scripting. For example, say your float tag is TagValue and your alarm is TagAlarm. The TagAlarm tag is a DB tag that has a static value. You can create a Tag Change Gateway Event Script on the TagValue with something like this:`value = newValue.value
if value < setpointValue:
    system.tag.writeToTag("TagAlarm", 1)`That would set the tag alarm high when it falls below the setpoint.

Next, your reset button on the screen can simply do the following:`system.tag.writeToTag("TagAlarm", 0)`Otherwise, you have to use your method with multiple tags.
