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.

Scheduler read
#1
Hi,

how can I read the time table of a schedule to activate an external function some times before ?
( if there is a time to turn on a light al 10.00 o'clock I 'd like activating the termostate 30' before of it )

BR,
Alberto
KNX Advanced Partner + Tutor
Reply
#2
(09.11.2022, 16:28)toujour Wrote: Hi,

how can I read the time table of a schedule to activate an external function some times before ?
( if there is a time to turn on a light al 10.00 o'clock I 'd like activating the termostate 30' before of it )

BR,
Alberto

Hi Alberto,
Take a look at this, maybe it can help you.
https://forum.logicmachine.net/showthrea...duled.time
Best regards Cristian
Reply
#3
Create a scheduled script that runs every minute. Make sure that the event you want to check has a unique name.
Code:
now = os.date('*t')
now_mins = now.hour * 60 + now.min

name = 'unique event name'
evt = db:getrow('SELECT * FROM scheduler_events WHERE name=?', name)

if evt then
  evt_mins = evt.start_hour * 60 + evt.start_min
  delta = evt_mins - now_mins

  if delta == 30 then
    -- 30 minutes before the event
    -- do something here
  end
else
  alert('event not found')
end
Reply


Forum Jump: