add module to get serial number

This commit is contained in:
Fanani M. Ihsan 2016-06-09 11:20:39 +07:00
parent 6d0a69ddee
commit 77887d1e7a

View File

@ -182,6 +182,21 @@ class ZK(object):
else:
raise Exception("Invalid response")
def get_serialnumber(self):
command = 11
command_string = '~SerialNumber'
checksum = 0
session_id = self.__sesion_id
reply_id = self.__reply_id
response_size = 1024
cmd_response = self.__send_command(command, command_string, checksum, session_id, reply_id, response_size)
if cmd_response.get('status'):
serialnumber = self.__data_recv[8:].split('=')
return serialnumber[-1]
else:
raise Exception("Invalid response")
def restart(self):
'''
restart connected device