Logic Machine Forum
Processing KNX Addresses - 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: Processing KNX Addresses (/showthread.php?tid=4760)

Pages: 1 2


RE: Processing KNX Addresses - admin - 29.05.2023

Looks better but since I don't know what exactly this script should be doing I can't tell if it's fully correct or not.

Couple of things to consider:
1. Event value is not used / checked at all.

2. readAndSetTemperature is called in a loop so grp.getvalue inside is called 10 times where as it could be one. The code can be optimized like this, so readAndSetTemperature is not needed:
Code:
local outValue

if zeroValue == false or controlValue == true then
  outValue = 0
else
  outValue = grp.getvalue(group .. '/0/15')
end

for j = 17, 117, 10 do
  local addr = group .. '/4/' .. j
  grp.checkwrite(addr, outValue)
end