02.12.2022, 09:29
(02.12.2022, 06:42)balatis Wrote: backuplist = { '6/0/33', '6/0/38' }
-- save current values
values = {}
for _, addr in ipairs(backuplist) do
values[ addr ] = grp.getvalue(addr)
end
night = grp.getvalue('1/7/1')
value = event.getvalue()
if value and night then
grp.write('6/0/33',true)
grp.write('6/0/38',true)
os.sleep(150)
end
-- restore values
for addr, value in pairs(values) do
grp.write(addr, value)
end
Good morning,
in above code i would like to do logging the values of 6/0/33 and 6/0/38, and i want to write in the previous group addresses, namely 6/0/32 and 6/0/37.
How can i do these?
Best Regards,
Chris Balatis
---------------------------------
use event.dstraw to get a number
for example:
data1=333
data1=666
dirnum = event.dstraw
dir_1 = dirnum + 1 -- or any offset positive or negative
dir_2 = dirnum + 2
grp.write(dir_1 , data1)
grp.write(dir_2 , data2)