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 that you accept these cookies being set.

ON Delay
#1
hello 
what is the best way to do an ON delay?
I have a resident script that monitors two values to check water leakage by comparing the tank level with a stored value (tank level when user activates level leakage detection) when the difference between the values becomes more than 2cm, the alarm will be triggered.
but sometimes the level sensor gives a pulse for a short time that will make a fake alarm, I think ON-Delay will be enough


I mentioned the case details to see if there are other ideas
Best Regards,
Reply
#2
Compare the update time to OS time and if diff is grater than X then send your telegram.
------------------------------
Ctrl+F5
Reply
#3
(01.09.2021, 15:04)Daniel. Wrote: Compare the update time to OS time and if diff is grater than X then send your telegram.

could you share an example
Best Regards,
Reply
#4
Code:
object = grp.find('1/1/1')

timer=10 --dealy
delta = os.time() - object.updatetime
    if object and object.data and delta > timer then
 
  --your action
  end
What is important is the delay and interval time of your script.  For example if delay is 10 and interval 2 then script will check 5 times the condition.
------------------------------
Ctrl+F5
Reply
#5
(02.09.2021, 09:54)Daniel. Wrote:
Code:
object = grp.find('1/1/1')

timer=10 --dealy
delta = os.time() - object.updatetime
    if object and object.data and delta > timer then
 
  --your action
  end
What is important is the delay and interval time of your script.  For example if delay is 10 and interval 2 then script will check 5 times the condition.

thank you, Daniel
If I got your point, does the example you mentioned means that I will have a 5*10 delay?
What is your recommendation for the delay and interval time, should be (=,>,<) or didnt matter?
Best Regards,
Reply
#6
if you make 50s delay and put 10s interval then the last check will be 50s +~10 sec
------------------------------
Ctrl+F5
Reply


Forum Jump: