doorlock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ef2493f1dfb90ee67fabd413eab8ca31dfc0b444
parent 581849eeef5811ab88893c203f4c9f08129ee8a5
Author: rbckman <rob@tarina.org>
Date:   Sun,  7 Nov 2021 12:19:50 +0200

keylogging

Diffstat:
Mdoorlock.py | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/doorlock.py b/doorlock.py @@ -44,10 +44,13 @@ def load_passcodes(): def check_if_open(): if GPIO.input(14): - #print('open door') + #print('Dörrn e ypi') GPIO.output(26, GPIO.HIGH) + return True else: + #print('Dörrn e stängd') GPIO.output(26, GPIO.LOW) + return False def is_webz_on(): try: @@ -84,7 +87,7 @@ def keylogger(code): def doordebug(): global apikey, open_door print('sending debug info to bygdis.fi api') - url = 'https://bygdis.fi/dorrkoderapi?apikey='+apikey+'&doorstate='+str(open_door) + url = 'https://bygdis.fi/dorrkoderapi?apikey='+apikey+'&doorstate='+str(check_if_open()) try: resp = requests.get(url=url) print(resp) @@ -122,6 +125,7 @@ def check(keypass): if keypass in passcodes: successbeep() open_door = True + keylogger(keypass) else: failbeep() @@ -129,7 +133,6 @@ def opendoor(): GPIO.output(26, GPIO.HIGH) GPIO.output(16,GPIO.HIGH) GPIO.output(20,GPIO.HIGH) - keylogger(keypass) time.sleep(5) def closedoor():