Logic Machine Forum
14 byte HEX - 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: 14 byte HEX (/showthread.php?tid=5937)



14 byte HEX - Domoticatorino - 19.03.2025

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


RE: 14 byte HEX - admin - 19.03.2025

Use loghex() to log the value in HEX format.


RE: 14 byte HEX - Domoticatorino - 19.03.2025

(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


RE: 14 byte HEX - admin - 19.03.2025

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

log(code)



RE: 14 byte HEX - Domoticatorino - 19.03.2025

(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


RE: 14 byte HEX - admin - 19.03.2025

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