Biometric Sync Tool Stepwise Guide

I am Having essl X990 Model and i am trying to use the biometric sync tool
but there are list of challenges I am facing can somebody pls guide with stepwise method of how to use this tool , its quiet on urgent basis.

Stuff I ahve already done:
1: Created employee added biometric id as same as provided in biometric
2: Created Auto attendance marking Shift
3:Connected Biometric Machine in Local network to script running PC
4: Added information in the GUI

5: logs are also getting created but getting following errors as well

File “C:\Users\Amit K Mehta\Downloads\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 51, in main
pull_process_and_push_data(device, device_attendance_logs)
File “C:\Users\Amit K Mehta\Downloads\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 117, in pull_process_and_push_data
erpnext_status_code, erpnext_message = send_to_erpnext(device_attendance_log[‘user_id’], device_attendance_log[‘timestamp’], device[‘device_id’], punch_direction)
File “C:\Users\Amit K Mehta\Downloads\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 181, in send_to_erpnext
response = requests.request(“POST”, url, headers=headers, data=data)
File “C:\Users\Amit K Mehta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\api.py”, line 61, in request
return session.request(method=method, url=url, **kwargs)
File “C:\Users\Amit K Mehta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py”, line 528, in request
prep = self.prepare_request(req)
File “C:\Users\Amit K Mehta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\sessions.py”, line 456, in prepare_request
p.prepare(
File “C:\Users\Amit K Mehta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py”, line 316, in prepare
self.prepare_url(url, params)
File “C:\Users\Amit K Mehta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\models.py”, line 390, in prepare_url
raise MissingSchema(error)

Pls guide where i am getting this wrong

i think the issue is with your local_config file. check your URL variable.

@adnan Can you pls guide in this issue I am a newbie here which Variable shall I check

the folder which youdownloaded, you’ll find one file local_config.py.template
make it’s copy with the name of. local_config.py

find below highlighted variables which you need to update.

Looks like your device logs are not fetched correctly. The error is raised because of missing device_attendance_log['user_id'] and device_attendance_log['timestamp']. Which are fetch one by one from device_attendance_logs[index_of_last+1:], and sent to erpnext api.

Share content from <Your Device Name>_<Your Device IP>_last_fetch_dump.json file located in the logs folder.

Hi Aamir

The employee id linked to erpnext is 3 & following is the data you required:

[{“uid”: 1, “user_id”: “2”, “timestamp”: 1622712866.0, “status”: 1, “punch”: 0}, {“uid”: 2, “user_id”: “2”, “timestamp”: 1622713111.0, “status”: 1, “punch”: 0}, {“uid”: 3, “user_id”: “2”, “timestamp”: 1622714035.0, “status”: 1, “punch”: 0}, {“uid”: 4, “user_id”: “2”, “timestamp”: 1622714665.0, “status”: 1, “punch”: 0}, {“uid”: 5, “user_id”: “2”, “timestamp”: 1622876057.0, “status”: 1, “punch”: 0}, {“uid”: 6, “user_id”: “3”, “timestamp”: 1623049777.0, “status”: 1, “punch”: 0}]

could you pls look into this and guide further

Try with these configurations:

PULL_FREQUENCY=60;
IMPORT_START_DATE='20210603';
"punch_direction": 'AUTO'

Your code does not get past the if condition in this method.


The employee_field_value and timestamp you are passing from send_to_erpnext method in data dictionary may not be right.

If the above doesn’t fix your problem then there might be something wrong with reading checkin-logs one by one and sending them to erpnext. The possibility is the data body is not right.

Push your code to a GitHub repository and share the link, I will have a look.

let me know which file are you talking about to check and send you the data

Did you try these? If this has not fixed your problem then I would like to know if you have changed the code in 'erpnext_sync.py`. If yes, share your code with the description of changes.

Yes i Did change the setting for the local config file as suggested by you .

Havent change anything in the erpnext_sync.py file following is the error log that it am getting now -

2021-06-08 13:45:10,184 ERROR Error during ERPNext API Call. 3 1623049777.0 test_1 IN Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 68, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 54, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 31, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 67, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1174, in call
return fn(*args, **newargs)
TypeError: add_log_based_on_employee_field() missing 2 required positional arguments: ‘employee_field_value’ and ‘timestamp’

2021-06-08 13:45:10,184 ERROR exception when calling pull_process_and_push_data function for device{“device_id”: “test_1”, “ip”: “192.168.0.104”, “punch_direction”: “AUTO”, “clear_from_device_on_fetch”: false}
Traceback (most recent call last):
File “C:\Users\Amit K Mehta\Downloads\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 51, in main
pull_process_and_push_data(device, device_attendance_logs)
File “C:\Users\Amit K Mehta\Downloads\biometric-attendance-sync-tool-master\erpnext_sync.py”, line 129, in pull_process_and_push_data
raise Exception(‘API Call to ERPNext Failed.’)
Exception: API Call to ERPNext Failed.

Following is the Attendance_failed_log

2021-06-08 13:54:14,266 ERROR 500 6 3 1623049777.0 0 1 {“uid”: 6, “user_id”: “3”, “timestamp”: “2021-06-07 12:39:37”, “status”: 1, “punch”: 0}

Kindly pls look in to this matter, I guess machine logs we are able to read but not able to send it across to erpnext… Need your assistance

Kindly help us in getting this sorted, seems we are able to read from machine but erpnext sync is still
a concern

@Amitmehta Your URL is not correct.:

it should be with https in config file. like below

https://ribosome.frappe.cloud/