LogicMachine Forum
Converting 1-byte object to several 1-bit status object - Printable Version

+- LogicMachine 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: Converting 1-byte object to several 1-bit status object (/showthread.php?tid=6433)



Converting 1-byte object to several 1-bit status object - stonecroft - 20.05.2026

Hello all.

I get feedback from a pharos lightning controller (from 0 to lets say 100) and want to convvert it to status object in knx.

The code below is working fine but I have some status that should be True if "status" = 31, if "status" is betwen 41-45 nothing shall happen and if "status" is any other  number status should be False.

How to do that?

Code:
status = event.getvalue()

if (status == 17 ) then
  grp.checkwrite('STATUS_SCEN1', true)
else
  grp.checkwrite('STATUS_SCEN1', false)
end

if (status == 18 ) then
  grp.checkwrite('STATUS_SCEN2', true)
else
  grp.checkwrite('STATUS_SCEN2', false)
end

if (status == 19 ) then
  grp.checkwrite('STATUS_SCEN3', true)
else
  grp.checkwrite('STATUS_SCEN3', false)
end



RE: Converting 1-byte object to several 1-bit status object - admin - 20.05.2026

Use this:
Code:
if status == 31 then
  grp.checkwrite('STATUS_SCEN4', true)
elseif status < 41 or status > 45 then
  grp.checkwrite('STATUS_SCEN4', false)
end



RE: Converting 1-byte object to several 1-bit status object - stonecroft - 20.05.2026

Thanks, work great