File tree Expand file tree Collapse file tree 5 files changed +45
-3
lines changed Expand file tree Collapse file tree 5 files changed +45
-3
lines changed Original file line number Diff line number Diff line change 1
1
# nfc-lock
2
2
NFC door lock
3
+
4
+ ## Installation
5
+
6
+ 1 . ` apt install python3-pip python3-systemd build-essential openssl `
7
+ 2 . ` cd /opt/ `
8
+ 3 . ` git clone https://github.com/KSIUJ/nfc-lock `
9
+ 4 . ` pip3 install -r requirements.txt `
10
+ 6 . ` mkdir crt `
11
+ 7 . ` openssl req -x509 -newkey rsa:4096 -keyout cert/$(hostname).key -out cert/$(hostname).crt -nodes -days 365 `
12
+ 5 . ` cp -r config-example/ config ` , change relevant values in ` config `
13
+ 6 . Create ` /etc/systemd/system/nfc-lock.service ` , contents below
14
+ 7 . ` systemctl daemon-reload; systemctl restart nfc-lock `
15
+
16
+ ` /etc/systemd/system/nfc-lock.service ` :
17
+ ```
18
+ [Unit]
19
+ Description=NFC door lock
20
+ After=multi-user.target
21
+
22
+ [Service]
23
+ Type=simple
24
+ WorkingDirectory=/opt/nfc-lock
25
+ ExecStart=/usr/bin/python3 -u /opt/nfc-lock/app.py
26
+ Restart=always
27
+
28
+ [Install]
29
+ WantedBy=multi-user.target
30
+ ```
31
+
32
+ Remember to adjust ` WorkingDirectory ` and ` ExecStart `
33
+
Original file line number Diff line number Diff line change
1
+ # Visible in ERC -> Clients
1
2
client_id = '1234567890asdgfghjklll'
2
- client_secret = '3434534534534535j3k4jhkj4h5k3jh45k3jh453'
3
+ client_secret = '3434534534534535j3k4jhkj4h5k3jh45k3jh453'
Original file line number Diff line number Diff line change
1
+ # Path to NFC reader USB device
1
2
nfc_reader = {
2
3
'input_device' : '/dev/input/by-id/usb-IC_Reader_IC_Reader_08FF20171101-event-kbd'
3
4
}
4
5
6
+ # GPIO mappings for info LEDs. Skip if no LEDs were attached.
5
7
led = {
6
8
'green_gpio' : 7 ,
7
9
'green_reversed' : False ,
8
10
'red_gpio' : 11 ,
9
11
'red_reversed' : False
10
12
}
11
13
14
+ # Lock configuration
12
15
lock = {
13
16
'lock_gpio' : 40 ,
14
17
'opening_time' : 5 ,
15
18
'lock_reversed' : True
16
19
}
17
20
21
+ # Configuration for a server that allows to remotely open the door
18
22
server = {
19
23
'port' : 1234 ,
20
24
'cert_file' : '/opt/nfc-lock/cert/lock.crt' ,
21
25
'key_file' : '/opt/nfc-lock/cert/lock.key'
22
26
}
23
27
28
+ # ERC server endpoint
24
29
erc = {
25
30
'endpoint' : 'https://ercendpoint.com'
26
31
}
27
32
33
+ # IDs of cards that can open the door when ERC is not available
28
34
hardcoded_uid = [
29
35
"12345678" ,
30
36
"90abcdef"
31
- ]
37
+ ]
Original file line number Diff line number Diff line change 1
- password = 'password'
1
+ # Secret password for some undocumented api that unlocks the door
2
+ password = 'password'
Original file line number Diff line number Diff line change
1
+ evdev ~= 1.4.0
2
+ requests ~= 2.25.1
3
+ urllib3 ~= 1.26.5
You can’t perform that action at this time.
0 commit comments