pyzkaccess
pyzkaccess copied to clipboard
Unable to pull event logs
hello i have a C3-100 device.
I can connect to the device, get the serial number and even open and close relays. The only think i can't do is get events. i am getting: pyzkaccess.exceptions.ZKSDKError: GetRTLog failed: SDK error -104: Real-time event data error Maybe i am doing something wrong
This is the code: from pyzkaccess import ZKAccess, ZK100
connstr = 'protocol=TCP,ipaddress=192.168.0.201,port=14370,timeout=4000,passwd=' with ZKAccess(connstr=connstr, device_model=ZK100) as zk:
print('Device SN:', zk.parameters.serial_number, 'IP:', zk.parameters.ip_address)
zk.relays.lock.switch_on(5)
card = None
while not card:
for door1_event in zk.doors[0].events.poll(timeout=60):
print(door1_event)
if door1_event.card and door1_event.card != '0':
print('Got card #', door1_event.card)
card = door1_event.card
zk.doors[0].relays.switch_on(5)
zk.disconnect()
This is the console output:
PS C:\Users\GS> & C:/Users/GS/AppData/Local/Programs/Python/Python311-32/python.exe c:/Users/GS/Desktop/ZKAccess.py
Device SN: AJMJ223260159 IP: 192.168.0.201
Traceback (most recent call last):
File "c:\Users\GS\Desktop\ZKAccess.py", line 15, in
count = self.refresh() # Can run up to several seconds depending on network
^^^^^^^^^^^^^^
File "C:\Users\GS\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyzkaccess\event.py", line 129, in refresh
new_events = [e for e in self._pull_events() if e.event_type != 255]
^^^^^^^^^^^^^^^^^^^
File "C:\Users\GS\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyzkaccess\event.py", line 294, in _pull_events
events = self._sdk.get_rt_log(self.buffer_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\GS\AppData\Local\Programs\Python\Python311-32\Lib\site-packages\pyzkaccess\sdk.py", line 122, in get_rt_log
raise ZKSDKError('GetRTLog failed', err)
pyzkaccess.exceptions.ZKSDKError: GetRTLog failed: SDK error -104: Real-time event data error
I solved the problem. It seems the is a C3-100 and i c3-100pro. i had the C3-100pro and it only works with the push sdk. I got the c3-100 now and everything is working