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.

Simple event-based script
#9
Hi,

Try this as event based on your light switching object:
Code:
value = event.getvalue()
if value == false then
 storagename = 'toilet_pid'
 oldpid = storage.get(storagename)
 pid = os.getpid()
 storage.set(storagename, pid)  
 if oldpid ~= nil then  
   os.kill(oldpid, signal.SIGKILL)
 end
 grp.write('1/1/2', true) -- Ventilator object
 os.sleep(120)
  grp.write('1/1/2', false) -- Ventilator object
 storage.remove(storagename)
end
BR,

Erwin
Reply


Messages In This Thread
Simple event-based script - by Superjohn - 07.02.2017, 19:13
RE: Simple event-based script - by Superjohn - 08.02.2017, 06:03
RE: Simple event-based script - by Superjohn - 13.02.2017, 20:32
RE: Simple event-based script - by Superjohn - 24.02.2017, 19:44
RE: Simple event-based script - by mlaudren - 24.02.2017, 21:30
RE: Simple event-based script - by Superjohn - 20.01.2018, 07:36
RE: Simple event-based script - by Erwin van der Zwart - 20.01.2018, 12:47

Forum Jump: