I am trying to set a RFID code in a zigbee driver. According to the Zigbee documentation it should be sent as octstr.
I have a code snippet that I took from a generic zigbee lock driver to convert from string to octstr. This works great with a 4-digit code but not with a RFID..
def codeHex = "" + zigbee.convertToHexString(code.length(), 4)
for(int i = 0; i < code.length(); i++) {
codeHex += "" + zigbee.convertToHexString((int) code.charAt(i), 2)
}
Example RFID: B51D1010.
Code converts to: 00084235314431303130
When using a online converter I get: 102 065 061 104 061 060 061 060
When trying to send the output from the snippet the lock does not responde at all. When sending the string from the online converter I get a success respond. But the RFID-tag is not accepted by the lock, so I think that that conversion isn't correct?
From the zigbee documentation:
My command: 0x921D 0x0B 0x0101 0x16 {01 01 00 00084235314431303130},
Does anyone know how to point me in the right direction?