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.

Search schedulers
#3
Modify the function like this:
Code:
function findtime(addr, value)
  local obj, file, data

  -- read data from cache file
  file = '/tmp/lm-scheduler-' .. os.date('%Y%m%d') .. '.lua'
  data = io.readfile(file)

  -- cache file missing, stop
  if not data then
    return
  end

  -- try decoding cache
  data = serialize.decode(data)
  if type(data) ~= 'table' then
    return
  end

  obj = knxlib.encodega(addr)
  for time, events in pairs(data) do
    if type(time) == 'number' then
      for _, event in ipairs(events) do
        if event.object == obj and value == toboolean(event.value) then
          return time
        end
      end
    end
  end
end
Reply


Messages In This Thread
Search schedulers - by CarlS - 07.02.2023, 08:28
RE: Search schedulers - by AEK - 07.02.2023, 08:40
RE: Search schedulers - by admin - 07.02.2023, 08:54

Forum Jump: