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.

Log / Unlog Objects via script
#1
Hi,  

Please, is there any way to turn on the log function of some objects via a tag and scheduled script? 

I want to log some presence between 00:00 and 07:00, one of them is detecting a wrong motion at that time, and I don't want to log all  the presences  the whole day because I will get a lot of unnecessary data
Reply
#2
Create two scheduled scripts that run at 0:00 and 7:00. Change group address as needed.

Code:
grp.create({ address = '0/0/1', log = true })

Code:
grp.create({ address = '0/0/1', log = false })
Reply
#3
(11.08.2022, 06:27)admin Wrote: Create two scheduled scripts that run at 0:00 and 7:00. Change group address as needed.

Code:
grp.create({ address = '0/0/1', log = true })

Code:
grp.create({ address = '0/0/1', log = false })
Thank you
Reply
#4
Code:
y = grp.getvalue('32/1/7')
x = grp.tag('Aufzeichnung')

m = #(x)
test = x[1].address
t = '32/1/8' -- TEST
log(m,y,test,t)

if y == true then
  u = 99 -- if log 99 then if was successfull
    for i = 1,m,1 do
    z = x[1].address --
    grp.create({ address = '32/1/6', log = true })--works
    grp.create({ address = z, log = true })--doesnt work
    log(z,u)
  end
else
  u = 77 -- if log 77 then if wasnt successfull
      for i = 0,m,1 do
      grp.create({ address = x[i].address, log = false })
    end
end
One quick question. Why does the first line of grp.create work and the second doesnt? Do i need to Convert the variable z to something else then string?

I want to change alot of Objects that all got the same tags. 

-- F.Braun

Attached Files Thumbnail(s)
   
Reply
#5
Use an event script instead of resident:
Code:
enabled = event.getvalue()

objs = grp.tag('Aufzeichnung')
for _, obj in ipairs(objs) do
  grp.create({
    address = obj.address,
    log = enabled
  })
end
Reply
#6
Thank you!

-- F.Braun
Reply


Forum Jump: