This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

grp.checkwrite() with delay
#1
is there such a function grp.checkwrite() after a specified delay time has expired?

I have some inputs and outputs for the associated inputs
I need to flag an error if after i turn the on an output, and after a delay of 30 sec or less depending on each input,  if the input dose not activate.

What is the best way to achieve this?
Currently i have event script on the output to check the state of the input but it is happening to fast and the input hasn't had time to change before i read it.
i can use os.sleep(), but i need this to be a blocking read, and it is only a short delay just long enough to allow time for the input to change before i read it again.

Or is it possible to in the output/s event script to wait until '1/1/12' (input address) changes state before continuing with the event script? 

Many Thanks
Reply
#2
You should compare updatetime from both objects. To do it use grp.find and you will get all info. Here is example of another script where grp.find is used to compare times. In your example you will need to compare two objects instead like here with os.time
Reply
#3
(04.05.2021, 07:23)Daniel. Wrote: You should compare updatetime from both objects. To do it use grp.find and you will get all info.  Here is example of another script where grp.find is used to compare times. In your example you will need to compare two objects instead like here with os.time

Ok I log grp.find(‘1/1/12’) and I return in table with the update time etc, I can get both update times for the objects and have a while loop to check which one was last changed? 
Or when the input update time > output update time then break loop and continue etc
Reply
#4
Use resident script to keep checking it periodically.
Reply
#5
(04.05.2021, 09:40)Daniel. Wrote: Use resident script to keep checking it periodically.

Thanks Daniel, I have it working how i need it,

Many thanks
Reply


Forum Jump: