This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Converting 1-byte object to several 1-bit status object
#1
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
Reply
#2
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
Reply
#3
Thanks, work great
Reply


Forum Jump: