59 lines
1.9 KiB
Markdown
59 lines
1.9 KiB
Markdown
# doorman2: electric boogaloo
|
|
|
|
- `esp32/` contains the micropython source which talks w/ NFC module and keypad over UART (two channels)
|
|
- `keypad/` has some magical Arduino code (sorry)
|
|
|
|
## syncing data from LDAP
|
|
|
|
big TODO; currently, you need to:
|
|
1. clone the old doorman repo and patch the `doorman_ldap_sync` file (see my shitty patch attached below)
|
|
|
|
```
|
|
--- a/admin/bin/doorman_ldap_sync
|
|
+++ b/admin/bin/doorman_ldap_sync
|
|
@@ -63,14 +63,18 @@ def get_target_cards(c):
|
|
|
|
if __name__ == "__main__":
|
|
url = argv[1] if len(argv) > 1 else options.url
|
|
- token = get_token()
|
|
- proto = Proto(url)
|
|
+ #token = get_token()
|
|
+ #proto = Proto(url)
|
|
|
|
c = ldap.initialize('ldap://ldap.hackerspace.pl')
|
|
c.start_tls_s()
|
|
- c.simple_bind_s('uid=%s,ou=People,dc=hackerspace,dc=pl' % (getpass.getuser(),), getpass.getpass('LDAP password: '))
|
|
+ c.simple_bind_s('uid=%s,ou=People,dc=hackerspace,dc=pl' % ('sdomi',), getpass.getpass('LDAP password: '))
|
|
target = get_target_cards(c)
|
|
- cur = get_current_cards(token, proto)
|
|
+ pprint.pprint(target)
|
|
+ for h, u in target:
|
|
+ print(h)
|
|
+
|
|
+ #cur = get_current_cards(token, proto)
|
|
|
|
to_remove = cur - target
|
|
to_add = target - cur
|
|
```
|
|
|
|
2. launch the script, copy all the lines with the hashes and save them a file
|
|
3. `mpremote fs cp hashes :hashes`
|
|
|
|
plans: web UI like vuko's design
|
|
|
|
## esp <-> keypad protocol definition
|
|
|
|
- one byte per command, no delimeters, keypad is supposed to be as stateless as possible
|
|
- the keypad can only send numbers and the hash symbol
|
|
- ESP can send the following commands:
|
|
- `H` ("happy" noise, success; turns on the green LED for a second and turns it back off)
|
|
- `S` ("sad" failure noise; likewise with the red LED)
|
|
- `F` ("flush"; turns off LEDs and tries to bring the env to a sane level)
|
|
- `G`, `R` ("green", "red"; turns on the specific LEDs)
|
|
- `Q` ("quiet"; turns on audible keypresses)
|
|
|
|
|
|
---
|
|
|
|
i am so sorry
|