Commit 428c89c 1 parent 6e4e135 commit 428c89c Copy full SHA for 428c89c
File tree 4 files changed +35
-3
lines changed
4 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Main Features
9
9
-----
10
10
11
11
- Programmatically add and remove users to/from the access control system
12
+ - Programmatically trigger the relay to open the door
12
13
- Convert the 10-digit format RFID numbers to comma format or vice versa
13
14
14
15
Hardware Requirement
@@ -57,13 +58,22 @@ Remove user (using 10-digit format RFID number):
57
58
58
59
client.remove_user(badge)
59
60
61
+ Open door #1 :
62
+
63
+ from rfid import RFIDClient
64
+
65
+ ip_address = '192.168.1.20'
66
+ controller_serial = 123106461
67
+ client = RFIDClient(ip_address, controller_serial)
68
+
69
+ client.open_door(1)
70
+
60
71
TODO
61
72
-----
62
73
- Add an optional name parameter to add_user. The access controller also stores the user's name.
63
74
- The controller also stores the user's 2-factor pin for when the keypad is enabled. Need to add an optional parameter to add_user for a pin.
64
75
- Add a get_users method to RFIDClient that outputs a list of all the users currently in the controller.
65
76
- Add a get_logs method to RFIDClient which outputs the card swipe logs.
66
- - Add an open_door method to RFIDClient.
67
77
68
78
Special Thanks
69
79
-----
Original file line number Diff line number Diff line change
1
+ from rfid import RFIDClient
2
+
3
+ ip_address = '192.168.1.20'
4
+ controller_serial = 123106461
5
+ client = RFIDClient (ip_address , controller_serial )
6
+
7
+ client .open_door (1 )
Original file line number Diff line number Diff line change @@ -128,6 +128,21 @@ def remove_user(self, badge):
128
128
recv_data = binascii .b2a_hex (self .s .recv (1024 ))
129
129
if (recv_data [:4 ] != '2321' ):
130
130
raise Exception ("Unexpected Result Received: %s" % recv_data )
131
+
132
+ def open_door (self , door_number ):
133
+ if not isinstance (door_number , int ):
134
+ raise TypeError ("RFID number must be set to an integer" )
135
+ if not (1 <= door_number <= 4 ):
136
+ raise Exception ("door_number must be 1 to 4" )
137
+
138
+ door_number = str (door_number - 1 ).zfill (2 )
139
+
140
+ open_door_packet = self .CRC_16_IBM ("2040" + self .source_port + "0500000000000000" + self .controller_serial + "0000020001000000ffffffffffffffff" + door_number + "000000" ).decode ('hex' )
141
+ self .s .send (self .start_transaction )
142
+ self .s .send (open_door_packet )
143
+ recv_data = binascii .b2a_hex (self .s .recv (1024 ))
144
+ if (recv_data [:4 ] != '2041' ):
145
+ raise Exception ("Unexpected Result Received: %s" % recv_data )
131
146
132
147
def __del__ (self ):
133
148
"""
Original file line number Diff line number Diff line change 10
10
11
11
setup (
12
12
name = 'Chinese-RFID-Access-Control-Library' ,
13
- version = '0.0.4 ' ,
13
+ version = '0.0.5 ' ,
14
14
description = 'A library for interfacing with one of the most common RFID Access Control System sold in China.' ,
15
15
long_description = readme ,
16
16
author = 'Paul Brown' ,
17
17
author_email = 'paul90brown@gmail.com' ,
18
18
url = 'https://github.com/pawl/Chinese-RFID-Access-Control-Library' ,
19
19
license = license ,
20
- download_url = ['https://github.com/pawl/Chinese-RFID-Access-Control-Library/tarball/master#egg=package-0.0.4 ' ],
20
+ download_url = ['https://github.com/pawl/Chinese-RFID-Access-Control-Library/tarball/master#egg=package-0.0.5 ' ],
21
21
keywords = ['rfid' , 'access control' ],
22
22
py_modules = ['rfid' ]
23
23
)
You can’t perform that action at this time.
0 commit comments