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.

Cool Heat Changeover
#2
Assign a common tag to all zone status objects. Map an event script to this tag. It will write true when more than half of tagged objects are true, false otherwise. Make sure that the status output object is not mapped to the same tag.

Code:
function tag_status(tag)
  local result, objects, count, halfcount

  result = false
  objects = grp.tag(tag)
  count = 0
  halfcount = math.floor(#objects / 2)

  for _, object in ipairs(objects) do
    if object.data then
      count = count + 1
    end
  end

  return count > halfcount
end

res = tag_status('central')
grp.checkupdate('1/1/1', res)
Reply


Messages In This Thread
Cool Heat Changeover - by KoBra - 30.06.2022, 09:49
RE: Cool Heat Changeover - by admin - 30.06.2022, 10:25
RE: Cool Heat Changeover - by KoBra - 04.07.2022, 06:45
RE: Cool Heat Changeover - by admin - 04.07.2022, 07:24

Forum Jump: