diff --git a/README.md b/README.md index 57ac99e..f0257da 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Das IdentityFile ist der Deploy-SSH-Key, der im [Repo](https://git.chaospott.de/ ### Schlüsselupdate Das Script [`foodoor-update-keydb`](debian/usr/sbin/foodoor-update-keydb) -aktualisiert regelmäßig die Schlüssel auf der Tür und baut die `Authorized_Keys` +aktualisiert regelmäßig die Schlüssel auf der Tür und baut die `authorized_keys` für die Benutzer `open` und `close`. Keys, die nicht dem OpenSSH-Format mit 4096 Bit entsprechen, werden ignoriert. diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control index 8c228fc..f1ebebc 100755 --- a/debian/DEBIAN/control +++ b/debian/DEBIAN/control @@ -1,5 +1,5 @@ Package: foodoord -Version: 3.3.3 +Version: 3.4.0 Maintainer: Tobi Architecture: all Description: Control the doors of the club, ja! diff --git a/debian/usr/sbin/foodoord_oben b/debian/usr/sbin/foodoord_oben index 9b16d1b..ff8760f 100755 --- a/debian/usr/sbin/foodoord_oben +++ b/debian/usr/sbin/foodoord_oben @@ -1,6 +1,7 @@ #!/usr/bin/env python3 # vim: ts=2 sw=2 et +import datetime import grp import json import os @@ -12,7 +13,7 @@ import threading import time from configparser import ConfigParser from dataclasses import dataclass -from datetime import datetime +from zoneinfo import ZoneInfo import paho.mqtt.client as mqtt import pifacedigitalio @@ -148,9 +149,13 @@ class Foodoord: self.pifacedigital.leds[gpio].turn_off() def doorbell(self, event): - day = datetime.now().weekday() - # NOTE: Monday is 0; do not unlock on Wednesday - if self.status_open and day != 2: + # ignore doorbell button on Wednesdays + now = datetime.datetime.now(ZoneInfo("Europe/Berlin")) + if ((now.isoweekday() == 3 and now.time() >= datetime.time(14)) + or (now.isoweekday() == 4 and now.time() < datetime.time(2))): + return + + if self.status_open: self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle() time.sleep(2) self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle()