Alarm acknowledged script on tag

context: im migrating an old WinCC 7.2 project to Ignition in which there are alarms that fire on set bits of a Word tag and there are also bits on that same Word tag that are used for acknowledgment for the PLC and HMI

for example: when bit 0 is set the alarm fires and when the user acknowledges it, it sets bit 1

i made the following script on a Memory Tag in Ignition to test my idea but the value won’t change, bit 1 wont be set.

def alarmAcked(tag, tagPath, alarmName, alarmEvent, alarmPath, ackedBy, missedEvents):

	val=tag.value | (1 << 1)
	system.tag.writeAsync([tagPath.value], [val])
  • what i expect to happen: the value to change to 3 (0011)
  • what actually happens: the value stays at 1 (0001)

i also tried with writeBlocking but i still dont get the expected outcome

any ides?