Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set User Not Working for My Device #128

Open
FaazAbidi opened this issue Aug 25, 2021 · 5 comments
Open

Set User Not Working for My Device #128

FaazAbidi opened this issue Aug 25, 2021 · 5 comments

Comments

@FaazAbidi
Copy link

Describe the bug
The method of ZK, the set user is not working on my ZK device.

To Reproduce
Steps to reproduce the behavior:

  1. image
  2. run the code
  3. Output with error message:
    image

Expected behavior
I expect the device to create a new user but it's not.

Capture Data
This is the specific error that I am getting when creating new user:

Response: {'status': False, 'code': 2001}
Process terminate : Can't set user

System (please complete the following information):

  • OS: Windows 10
  • Python version 3.9
  • Device Firmware Version: : Ver 6.60 Jan 23 2015
  • Device Name: CL2
  • Device Model Name: : BRR2184860289

Additional context
Other methods are working fine like getting attendances and users.

@FaazAbidi
Copy link
Author

@fananimi Please help.

@ycdaskin
Copy link

You have to create user in 3 steps. It is a bug i guess. First you have to initialize user. Second you have to get all users (i don't know why but this is the only way that works). Last you have to set name and card id. I resolved it like this:

zk.set_user(uid=uid, user_id=str(user_id), privilege=const.USER_DEFAULT) # initialize users
zk.get_users() # fetch all users
zk.set_user(uid=uid, name=user_name, card=card) # set name and card by uid

@specha
Copy link

specha commented Dec 11, 2021

Also if u aren't sure of the uid, if it exists or not, You need to pass a unique uid not present in the system. Coz for some reason in my testing, it would not choose a user by itself. If you haven't checked the uid uniqueness, might help to first check existing user's UID and then choose a unique one to send with set user

@ayazmhmd
Copy link

ayazmhmd commented Feb 9, 2024

did anyone resolved this issue as i am facing the same issue on my device for set user

@core-burner
Copy link

Set_user works for me including overwrites.
Your firmware version is quite atypical - I never saw a 6.60
It would be helpful to see the result of get_users.
command_string = pack('HB5s8sIxBHI', uid, privilege, password.encode(self.encoding, errors='ignore'), name.encode(self.encoding, errors='ignore'), card, int(group_id), 0, int(user_id))
suggests name shouldn't be longer than 5s, it should truncate but worth a try to shorten.
If you want to create a new user, use enroll_user instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants