Logic Machine Forum
storage - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: storage (/showthread.php?tid=4416)



storage - balatis - 02.12.2022

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


RE: storage - kike - 02.12.2022

(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)


RE: storage - admin - 02.12.2022

See this: https://forum.logicmachine.net/showthread.php?tid=2278