caobo171 / node-zklib

This is a lightweight of node.js module to connect to biometrix attendance device for examples ZKTeco
70 stars 59 forks source link

getRealtimeLogs not working #26

Open dev-iot-jogja opened 3 years ago

dev-iot-jogja commented 3 years ago

Here my code

const ZKLib = require('./zklib')

let machine_ip = '192.168.192.168';

const test = async () => {
    let zkInstance = new ZKLib(machine_ip, 4370, 10000, 4000);
    try {
        await zkInstance.createSocket()
        console.log(await zkInstance.getInfo())
    } catch (e) {
        console.log("init", e);
    }

    try{
        zkInstance.getRealTimeLogs((data)=>{
            // do something when some checkin 
            console.log('real time', data)
        })
    } catch (e) {
        console.log("realtime error", e)
    }
}

test()

when I try to log, I found that checkNotEventTCP on getRealTimeLogs return CMD_ACK_OK not EF_ATTLOG or CMD_REG_EVENT

what should I do to make getRealTimeLogs working?

mahrous78 commented 3 years ago

getRealTimeLogs is not working with me too

caobo171 commented 3 years ago

Sorry for responding lately, but did you guys make sure that there'is no another machine connect to that device. Because even if it connected successfully but realtime event is not allowed for multiple devices

herormo commented 3 years ago

Not working for me too, there is only one machine connected to the device. @dev-iot-jogja did you manage to fix this?

danishthetechie commented 2 years ago

No it is not connected. Could you please have a look, I tried several times.. I really need to do this pal. We can even skype, or call

danishthetechie commented 2 years ago

No other machine is connected. but still not working

MoradAbdelgaber commented 2 years ago

@caobo171 any news here for this bug . still getting nothing with getRealTimeLogs

AlifElahi commented 2 years ago

Hey, I am also facing the same issue. Has anyone found any workaround? (@danishthetechie, @MoradAbdelgaber ) @caobo171 brother have you happened to have some time to look at this?

ebgutierrez commented 2 years ago

Hi, I'm having the same issue here. Is there any update on this or any work around? I'm afraid to touch the core codes, also not that good with buffers and packets.

danishthetechie commented 2 years ago

No, haven't found any resolution regarding this. still my work is pending on getRealTimeLogs issue

mahrous78 commented 2 years ago

the python lib works fine

JorgeSolisC commented 2 years ago

@danishthetechie encontraste alguna solución?

JorgeSolisC commented 2 years ago

@dev-iot-jogja did you find a solution?

danishthetechie commented 2 years ago

@dev-iot-jogja did you find a solution?

No, no solution found for real time logs

aadrsh commented 2 years ago

when I try to log, I found that checkNotEventTCP on getRealTimeLogs return CMD_ACK_OK not EF_ATTLOG or CMD_REG_EVENT

@caobo171 @dev-iot-jogja Yeah same here, Found that getRealTimeLogs function is exiting after checkNotEventTCP check so I tried commenting out the check I found out that the packet returned by machine is Regular Packet instead of a Realtime Packet,

Machine Reply after requesting Realtime data is still a Regular Packet <Buffer 50 50 82 7d 08 00 00 00 d0 07 45 e5 e7 12 03 00>

Referring to https://github.com/adrobinoga/zk-protocol/blob/master/protocol.md First 2 bytes of Regular Packet is Command ID, next 2 Bytes are Checksum, next 2 are sessionId and rest are reply number and data

But in case of realtime packet CommandID should be 500 But it is ACK_OK i.e. 2000 and instead of realtime event id it sends session ID thats why checkEventNotTCP is true

So.. what I think is the machine isn't sending realtime packets or if its sending then we are not receiving it I am not good with sockets or js but this is what i came up with

shahria7k commented 1 year ago

the python lib works fine which lib?

daoues1 commented 1 year ago

the python lib works fine @mahrous78 it is'nt working for me with the python lib could you explain how did u make it work ?

catajoynick commented 1 year ago

No fix for this one?

daoues1 commented 1 year ago

Nope still On Wed, 7 Jun 2023 at 13:27 catajoynick @.***> wrote:

No fix for this one?

— Reply to this email directly, view it on GitHub https://github.com/caobo171/node-zklib/issues/26#issuecomment-1580714564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMH6H3OLKI72AZ3FFYDFYM3XKBXSNANCNFSM4PHJQXYQ . You are receiving this because you commented.Message ID: @.***>

catajoynick commented 1 year ago

Oh, then I cant use this library then. Thanks for reply.

Muddasir1 commented 7 months ago

the python lib works fine

can you share with us code ?