"No change" alarming

Piotr you saved me some time though it still took a bit to get this to work to my liking. Here is my slightly modified version of your solution:

Here is the on change event script inside the desired tag.

	# make sure this change wasn't caused by ignition restarting
	if initialChange == False: 
		# detect change with the built in currentValue and previousValue provided by the Value Changed event handler 
		if currentValue > previousValue or currentValue < previousValue:
			# write current time to a memory tag to alarm on later
			valueTimestamp = system.date.toMillis(currentValue.timestamp)
            system.tag.write("[.]casing_pressure_no_change", int(valueTimestamp))

And here is the expression used in the memory tag’s alarm setpoint. It executes every 30 seconds and subtracts 15 minutes from current time. The alarm is configured to go off if the timestamp in the memory tag is less than this value i.e. 15 minutes old.

toMillis(now(30000)) - 900000

Oh, and why I didn’t use the tags timestamp and compared current value to previous value is this data is received from an external MQTT Sparkplug publisher (outside of my control) and when the data flatlines on the other side it still publishes the same exact value i.e. the timestamp changes but the data doesn’t…

2 Likes