Im working on making an audible alarm system triggered when any Active Unacknowledged alarm is present. I have a sound player placed on my navigation window so it will be present no matter what page im on. I have two custom properties on the sound player. First, “alarmCount” which is bound to the system gateway tag value for Active Unacknowledged alarms. Second, “enableAudio” is simply a Boolean value used to turn the script on and if for testing purposes. So overall the script works well. The issue is that the .wav file will fire off multiple times when the sound player is triggered. I have placed a print statement to verify that the sound will fire more than once. Is there a way I can prevent the file from playing more than once? I’m a novice at coding, so I’m curious if there is a method or command that can prevent this from happening. Also, I must keep the sound on loop because the whole idea is to keep the sound playing as long as there is any active unacknowledged alarms. The sound is a short one 3 second alarm sound.
This script enabled an audible sound if any Active alarm is unacknowledged.
The Custom Property “alarmCount” if bound to the System Gateway Active Unacknowledged alarm count.
The enableAudio Custom Property is simplay there as a handle to turn the script ON/OFF.
The alarms variable stores the Active Unacknowledged value to refrence.
audibleEnabled = event.source.enableAudio alarms = event.source.alarmCount if audibleEnabled == True: if alarms > 0: alarmEnabled = True else: alarmEnabled = False if alarmEnabled == True: event.source.trigger = True print "Fire Sound" else: event.source.trigger = False