(18.03.2019, 22:03)Erwin van der Zwart Wrote: Hi,
Try this:
BR,Code:tagname = 'tag name'
for _, obj in ipairs(grp.tag(tagname)) do
if obj.value then
return
end
end
log('All objects are false')
Erwin
Hi.
Thanks a lot!
With a lot of trial and error, i finaly got this to do what i want. If all tags are false, then Lights_status is false. If one or more of the tags are true, then Lights_status are true :)
tagname = 'Lights_room1'
Lights_status = grp.find('1/1/137')
for _, obj in ipairs(grp.tag(tagname)) do
if obj.value then
return
Lights_status:write(true)
end
end
Lights_status:write(false)
And here a little more adjusted to suite my purpose better in a bigger script, and to work with only tag's (no group adresses) :)
for _, obj in ipairs(grp.tag('Lights_room1')) do
if obj.value then
return
grp.tag('All_lights'):write(true)
end
end
grp.tag('All_lights'):write(false)