12.04.2023, 05:19
For loop after if is not needed otherwise you write might run 20 times in a row.
To invert the current value use this:
To invert the current value use this:
Code:
if #res == 20 and res[4] == 0x11 and (res[8] == 0x80 or res[18] == 0xFF) then
value = grp.getvalue('13/1/21')
grp.write('13/1/21', not value)
end