Biometric Data not syncing to ERPNext
When we syned out zkteco data, the dates were coming as future dates and it gave errors like day not in month, etc.
ok, I checked your data, and sadly, I don't remember if I found and 8 byte record on the wild or just used the documentation.
according the documentation, the 8 byte attendance log is
typedef struct _AttLog_{Int PIN; //U16 PIN, user serial numberchar verified;// matching waytime_t time_second; // time, time encoding is customized time encoding.。char status; // attendance condition}TAttLog, *PAttLog;
so the 8 byte packet should be "HB4sB" where the third element is feeded to __decode_time
and produce your wrong data...
luckily comparing with the get_time response, if we switch the packet order it produces a better response, so the fourth element of "HBB4s" produces a date on 2019-10-01 10:34:50
I'll try to dig an old device to see if it's 8 bytes or not, by the time, please change the line 1563 of base.py
to
uid, status, punch, timestamp = unpack('<HBB4s', attendance_data.ljust(8, b'\x00')[:8])
that should help. (please note the struct change and the response order)
If we can get more devices with 8 bytes to confirm this issue, I'll commit to master.
On my machine, it seems that the 3rd byte is combined of both status and punch. The high 4 bit is for punch and the lower is status. The 4th byte is always zero in my log. There for in my case, I useduid, status, timestamp = unpack('<HBx4s', attendance_data.ljust(8, b'\x00')[:8])`punch = status >> 4status = status ^ 0xF