How to check if a tag hasn't changed value for one minute?

Hi All,

Is there a way in ignition to check if a tag hasn't changed value for a certain amount of time like for a minute say?


You can use the timestamp property of the tag. It updates anytime the tag value changes:

lastChange = system.tag.readBlocking('YourTagPath.Timestamp')[0].value
now =
if, now) > 1:
	print 'True'
	print 'False'

Thanks for the reply, where do I put this code? Under tag event scripts?

Basically I want this script to be running in the background when the machine is turned on.

Tag event scripts won't work. That need tag "Change". Maybe you could create a Gateway Events Timer script.

Then disregard what I posted above; perhaps more context is needed for us to answer this question correctly. What is expected to happen if the tag has changed? What changes the tag? What is the tag for?

Is this something that will affect the client interface, or is the machine supposed to respond in some way to this change?


If you are in perspective, then you can use NOW(60000) timestamp with change script to create a client level timer. This timer will execute every one minute and you can see if the tag value is changed by using a last_value and current_value combination.


Personally, I would create an expression tag that looks at the timestamp value in the tag you care about, and compares it to the time now. If it is a minute or more in the past, then go true, i.e.:

secondsBetween({[.]path_to_tag.Timestamp},now()) >= 60

Or you could use Jonathans expression in an "On Condition" alarm on the tag that is of interest.

1 Like