Alarm Icons - Looking for alternate ideas - potential feature request

I have a need (desire) to show an alarm icon at various places on a screen.

image

This needs: if alarms are active, highest priority, and if there are unAcked alarms.

I am currently doing this through an expression on a property.

## Expression (randTimer is a random number between 5000 - 10000)
#     used to keep all instances on a page from firing at the same time. (upwards of 50+)
#     srcPath below is a path.  Could be a tag or a directory name
now({view.custom.randTimer})

### 1st transform
# looks to see if there are any active alarms (low-Critical)
forceQuality( if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 4, 1, 0, 1, 0)=false,0,100), 192 )

### 2nd transform
# this determines the priority using a go-fish method stopping at the highest priority found.
if({value}<100,{value},
	if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 4, 4, 0, 1, 0),140,
	if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 3, 3, 0, 1, 0),130,
	if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 2, 2, 0, 1, 0),120,
	if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 1, 1, 0, 1, 0),110,
	{value}))))
)

### 3rd transform
# this looks for unAcked.  Adds 1 to total number.
forceQuality(if(isAlarmActiveFiltered({view.custom.tag.srcPath}, "*", "*", 4, 1, if( {value}>100,0,1) , 0, 0)=false, {value}, {value}+1),192)

This expression(s) generates a number from 0 - 141. First char being alarm active, second being priority, third being unAcknowledged. (only care about low-critical). This is fed into a change script for furthur processing (included below for completeness).

My question is, anyone have a more direct way to do this. Answer may be no, but just making sure I'm not missing something. I think I added a feature request for this some time ago... I do know about the highestPriority on an individual tag, but this is generally called on a tag structure.

-- change script on expression above. --

def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	cv = currentValue.value
	def chkOutput(value) :
		if value < 100 : return [ False, '', False ]
		priority, unacked = divmod(value-100,10)
		return [ True, priority, unacked>0 ]
	
	# output = [ 'active', 'level', 'unAcked' ]
	output = [ False, '', False ]
	if cv == 1 : output = [False,'',True]
	elif cv >= 100 : output = chkOutput(cv)
			
	self.custom.alarm.active, self.custom.alarm.level, self.custom.alarm.unAcked = output

Perhaps use something like this resource to gather alarms...

... and this for visualization...

1 Like

Thank you. I'll look into those!

We're actively working on new functionality related to alarm aggregation for folders/UDTs in 8.3.0.

4 Likes