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.

14 byte HEX
#1
Hi,
I would like to manage the code digit on an access control KEYPAD. When I set the object at 14 byte HEX I can see the digit on the group address list but in the log of the scripting I see only "?????".

In this way I cannot manage the code. How can I solve it please?

Thanks.

BR
Reply
#2
Use loghex() to log the value in HEX format.
Reply
#3
(19.03.2025, 10:55)admin Wrote: Use loghex() to log the value in HEX format.

Thanks!

(19.03.2025, 10:55)admin Wrote: Use loghex() to log the value in HEX format.

Sorry, but why I cannot to use this instruction?

first6 = string.sub(value,1,6)

Sorry, I mean that I would like to keep just the first 6 digit of the value. Hence:


value = event.getvalue()

loghex(value)

first6 = string.sub(value,1,6)

log('first6 string is:', prime6)

I tried to convert value "tostring" without success.

What could you suggest please?

Tks.

BR
Reply
#4
Try this:
Code:
value = event.getvalue()
bytes = { value:byte(1, 6) }
code = table.concat(bytes)

log(code)
Reply
#5
(19.03.2025, 12:42)admin Wrote: Try this:
Code:
value = event.getvalue()
bytes = { value:byte(1, 6) }
code = table.concat(bytes)

log(code)

it does not work because the number result is not correct. I log this follow with loghex(value):

Quote:* arg: 1
  * hexstring [13]: 69 6C 20 6E 75 6D 65 72 6F 20 C3 A8 3A
* arg: 2
  * hexstring [4]: 12 12 12 01

The number I want to take are 121212.

It is consider a table with 2 value?

Thanks.

BR
Reply
#6
Try this:
Code:
value = event.getvalue()
code = lmcore.strtohex(value:sub(1, 3))
log(code)
Reply


Forum Jump: