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.

How to control event based script
#6
(23.09.2018, 13:05)Erwin van der Zwart Wrote: Hi,

event.getvalue() already knows it's current event.dst, so you don't need to pass a variable to the function.

This script below also kills a eventual parallel running script:
Code:
keep_on = grp.getvalue('32/1/4')
if keep_on == false then
  value = event.getvalue()
  if value == true then
     tpid = storage.get('PID:' .. _SCRIPTNAME)
     if tpid ~= nil then
        os.kill(tpid, signal.SIGKILL)
     end
     pid = os.getpid()  
     storage.set('PID:' .. _SCRIPTNAME, pid)
     os.sleep(600)
     grp.write(event.dst, false)
     storage.delete('PID:' .. _SCRIPTNAME)
  end
end
BR,

Erwin

Hi Erwin,
just a clearify. This script above you mean to add in the same event base script created or we have to add another event base script?

Thanks.
Reply


Messages In This Thread
How to control event based script - by 02dag - 22.09.2018, 18:50
RE: How to control event based script - by Domoticatorino - 04.10.2018, 10:08

Forum Jump: