adrobinoga / zk-protocol

A precise, clean and easy to understand description of the protocol used in ZKTeco devices
180 stars 76 forks source link

Polling a device to get attendances log #6

Open Barabba11 opened 3 years ago

Barabba11 commented 3 years ago

Hi mate, sorry to open a issue to ask you something but it may be useful to someone else. I've chance to buy some ZkTeko fingerprint devices for a reasonable price, but it doesn't support ADMS. As now ADMS is the only way I know to get attendances from Filemaker, I mean it allow terminal send immediatly the attendance to the ADMS server, that will fill up its database; it is just necessary then to poll often the server database, to get the infos. A bit complex but it works.

It can be much easier if with the protocol you discover we can poll directly the terminal, just for ask attendances, I suppose the terminal replies with all attendance in its memory, we can do so about each minute. Maybe there is a plugin for Filemaker to manage/send tcp ip packets. Do you think it's possible? This protocol simulates Access (software) so I guess it will work with any device. Thank you for kind answer

adrobinoga commented 3 years ago

Yes It is possible, the process to request info is not that complicated, maybe you can get an idea reading this section https://github.com/adrobinoga/zk-protocol/blob/master/sections/terminal.md#connection (this is called terminal because is related to changing terminal's config, not because of CLI based interface) now what I found complicated while doing the lib Pyzatt is how to parse that info, but the besides that the flow is basically creating a TCP socket, reading user info, reading att log, then closing the socket. what maybe would be interesting to check is how works the device when polling data like this if you take a look at the protocol it says disable the device before reading records so if you are polling data every minute, then the device may be unavailable 2 seconds every minute I do not think they were designed for that small intervals, maybe thats why they are considered standalone you only read data to update the centralized database in your desktop pc running ZKAccess, 3 or 4 times a day and every time you make changes to user access permissions (timezones, groups, etc) i think polling every hour sounds more reasonable

Barabba11 commented 3 years ago

Thank you a lot dear friend for your kind answer :) and please sorry me for my delay, As I know some Zkteko devices has the push notification function by protocol ADMS which connects to WDMS software, but they are too few and can't find the proper one. Maybe there are new protocols/function to send istantaniusly the time attendance? My goal is to associate the attendance with a photo, there was F21 (with ADMS) who was able to do that but now is out of production.. and I need to associate the attendance to the photo of an external camera. The camera produces itself fotos with minute and second, i can search for date and time but the system should be good syncronized.. so when I "poll" the standalone terminal I can download all and associate