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.

status of 100 windows and send a command to turn off the AC
#7
(04.07.2024, 08:33)admin Wrote: You can use this as a scheduled script. mapping table contains tag as a key and output address as a value.
Off is sent to the output address when at least one of the tagged objects is true. Otherwise no action is performed.

Code:
function tag_or(tag)
  local result = false
  local objects = grp.tag(tag)

  for _, object in ipairs(objects) do
    result = result or object.data
  end

  return result
end

mapping = {
  ['window1'] = '1/1/1',
  ['window2'] = '1/1/2',
  ['window3'] = '1/1/3',
  ['window4'] = '1/1/4',
}

for tag, output in pairs(mapping) do
  value = tag_or(tag)

  if value then
    grp.write(output, false)
    os.sleep(0.2)
  end
end

This script is exactly what I needed. Thank you, admin!
Reply


Messages In This Thread
RE: status of 100 windows and send a command to turn off the AC - by Osvaldas - 08.07.2024, 06:18

Forum Jump: