How to write the Gateway Alarm Active and Ack count to PLC

I need to get the Gateway Alarm Active and Acknowledge count to the PLC. What would be the best way to get this value to my PLC? Does anyone have a sample script that could do this?

Something like this in a timer script should do it, adjust the filters to your liking:

paths = ['[default]AlarmsActive', '[default]AlarmsAcked']
activeCount = len(system.alarm.queryStatus(state = [2]))
ackCount = len(system.alarm.queryStatus(state = [0,1,3]))
system.tag.writeBlocking(paths, [activeCount, ackCount])

There are other places you could run this, like in an expression tag, though i don’t know if that would impact performance.

This is exactly what I was looking for, Thanks!

1 Like