Change label name every hour

hi,
I have four status like A,B,C,D. when a tag value changes to true, the status has to change to A. After 2hrs it should automatically change to B. Like this for every 2hrs it has to change to next status. Can i do like this? any solution?

A lot of possible solutions. The fact you tagged Vision forces me to give addition explanation.
None of the delays or tag changes should be based on Vision/Client Scope. Everything should be done at the gateway.

The simplest solution is by using system.util.sendMessage - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com) inside a tag value change script. Make sure to create a gateway scope message handler.

When currentValue.value == True send the message handler, Also write ‘A’ to that state tag…
Inside the message Handler script you may wanna import
from threading import Timer or from time import sleep as shows in Adding a Delay to a Script - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com) to add 2hrs delay. With each delay write the new state.

Gateway Timer or Scheduled Scripts may also be a good option, but I don’t think is beneficial in your case.

Mentioning Scheduled Script, if any IA person can confirm if problems were already fixed?

Expression tag:
EDIT Sorry, just noticed I didn’t actually post it. :roll_eyes:

if({[~]BoolTag},
	case(floor(secondsBetween({[~]BoolTag.Timestamp}, now()) / 2), 
		 0, 'A',
		 1, 'B',
		 2, 'C',
		 3, 'D',
		 'Error'
		),
	'Idle'
   )
1 Like