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.

Staircase timer
#2
(03.08.2017, 08:05)Kuronen Wrote: Being new to LUA I´m finding it difficult to get everything right. Could some one help me with below.?? Please Huh

I have tried to create a simple Staircase timer for lighting control with the following functions:

1bit KNX command = true activates (From presence detector)

(1.) Sends a KNX Byte value  "90%"

(2.) After not receiving (1bit from presence detector) in 30 min send KNX byte value 20%

(3.) After not receiving (1bit from presence detector) in 60 min send KNX byte value 0%

(( If triggered by 1bit from presence detector it should re-trigger the staircase timer.))

I need to run multiple staircase timers for different areas with the same LM unit.!
Hi!
here is example. but its not good to use so big os.sleep timer in event based script
just add event based script for your presense sensor group address

Code:
scale_adress= '1/1/4'
value = event.getvalue()
storage_name = 'staircase '..event.dst
if value then
 -- writing 100% to scale object
 grp.write(scale_adress, 100)
 -- getting object info
 obj = grp.find(event.dst)
 
 --getting update time of presense sensor in seconds
 upd_time = obj.updatetime
 --setting this update time to storage
 storage.set(storage_name, upd_time)

 --(watinng for 40 minutes)
 os.sleep (40*60)
 -- checking if the sensor was updated
 n_obj = grp.find(event.dst)
 n_upd_time = n_obj.updatetime
 old_upd_time = storage.get(storage_name)
 -- if update times does not equal - exiting from script
 if n_upd_time ~= old_upd_time then
   return
 end
 -- if times are equal writing 20
 grp.write(scale_adress, 20)
 -- wating for 20 minutes
 os.sleep (20*60)
 -- again checking update time
 n_obj = grp.find(event.dst)
 n_upd_time = n_obj.updatetime
 old_upd_time = storage.get(storage_name)
 -- if update times does not equal - exiting from script
 if n_upd_time ~= old_upd_time then
   return
 end
 -- if stil equal write 0
 grp.write(scale_adress, 0)
 
end
Reply


Messages In This Thread
Staircase timer - by Kuronen - 03.08.2017, 08:05
RE: Staircase timer - by AEK - 03.08.2017, 08:45
RE: Staircase timer - by Kuronen - 03.08.2017, 10:42
RE: Staircase timer - by Erwin van der Zwart - 03.08.2017, 11:05
RE: Staircase timer - by Kuronen - 03.08.2017, 12:19
RE: Staircase timer - by Kuronen - 03.08.2017, 17:30
RE: Staircase timer - by Erwin van der Zwart - 03.08.2017, 20:03
RE: Staircase timer - by Kuronen - 03.08.2017, 20:36
RE: Staircase timer - by admin - 04.08.2017, 08:06

Forum Jump: