04.07.2024, 08:33
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.
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