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

**URL:** <https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568>\
**Category:** Ignition\
**Created:** [February 8, 2023, 4:18am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568 "2023-02-08T04:18:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bharathan\_Rajakumar](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bharathan\_Rajakumar](https://forum.inductiveautomation.com/u/Bharathan_Rajakumar)\
**Post date:** [February 8, 2023, 4:18am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/1 "2023-02-08T04:18:05Z")

</div>

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?

Thanks

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 8, 2023, 4:50am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/2 "2023-02-08T04:50:23Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Bharathan\_Rajakumar](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bharathan\_Rajakumar](https://forum.inductiveautomation.com/u/Bharathan_Rajakumar)\
**Post date:** [February 8, 2023, 5:23am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/3 "2023-02-08T05:23:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nideyijuyidong](https://avatars.discourse-cdn.com/v4/letter/n/7cd45c/32.png) [@nideyijuyidong](https://forum.inductiveautomation.com/u/nideyijuyidong)\
**Post date:** [February 8, 2023, 5:43am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/4 "2023-02-08T05:43:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [February 8, 2023, 7:21am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/5 "2023-02-08T07:21:00Z")

</div>

> [@Bharathan\_Rajakumar](#):
>
> I want this script to be running in the background

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?

---

<div class="post-metadata">

**Author:** ![Usman\_Ashraf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/usman_ashraf/32/43168_2.png) [@Usman\_Ashraf](https://forum.inductiveautomation.com/u/Usman_Ashraf)\
**Post date:** [February 8, 2023, 8:10am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/6 "2023-02-08T08:10:04Z")

</div>

Hi,

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.

Thanks.

---

<div class="post-metadata">

**Author:** ![jonathan.taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jonathan.taylor/32/4048_2.png) [@jonathan.taylor](https://forum.inductiveautomation.com/u/jonathan.taylor)\
**Post date:** [February 8, 2023, 8:51am UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/7 "2023-02-08T08:51:23Z")

</div>

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.:

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

```

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [February 8, 2023, 12:00pm UTC](https://forum.inductiveautomation.com/t/how-to-check-if-a-tag-hasnt-changed-value-for-one-minute/69568/8 "2023-02-08T12:00:40Z")

</div>

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