pyztk/test_voice.py
Arturo Hernandez 86826f9f7c MEGA UPDATE!
now with TCP support (on test!)
mayor fixes but trying to keep functionality
2018-04-25 20:42:04 -04:00

44 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import sys
import argparse
from time import sleep
from zk import ZK, const
sys.path.append("zk")
parser = argparse.ArgumentParser(description='ZK Basic Reading Tests')
parser.add_argument('-a', '--address',
help='ZK device Addres [192.168.1.201]', default='192.168.1.201')
parser.add_argument('-p', '--port', type=int,
help='device port [4370]', default=4370)
parser.add_argument('-T', '--timeout', type=int,
help='timeout [60]', default=60)
parser.add_argument('-P', '--password', type=int,
help='Device code/password', default=0)
parser.add_argument('-f', '--firmware', type=int,
help='test firmware', default=8)
args = parser.parse_args()
conn = None
zk = ZK(args.address, port=args.port, timeout=args.timeout, password=args.password, firmware=args.firmware)
try:
print 'Connecting to device ...'
conn = zk.connect()
print 'Disabling device ...'
conn.disable_device()
print 'Firmware Version: : {}'.format(conn.get_firmware_version())
for i in range(0,65):
print "test_voice, %i" % i
zk.test_voice(i)
sleep(3)
print 'Enabling device ...'
conn.enable_device()
except Exception, e:
print "Process terminate : {}".format(e)
finally:
if conn:
conn.disconnect()