This commit is contained in:
T 2025-01-14 19:04:13 +01:00
parent bd7532a080
commit 1941698a52
4 changed files with 15 additions and 14 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash
VERSION=3.3.0
VERSION=3.3.1
dpkg-deb --root-owner-group -b debian "foodoord_${VERSION}_all.deb"

View File

@ -1,6 +1,6 @@
Package: foodoord
Version: 3.3.0
Maintainer: Bandie <bandie@chaospott.de>, Tobi <tobi@chaospott.de>
Version: 3.3.1
Maintainer: Tobi <tobi@chaospott.de>
Architecture: all
Description: Control the doors of the club, ja!
Depends: dash, git, python3, pip, tmux

View File

@ -26,8 +26,9 @@ while [ "$prompt" != "oben" ] && [ "$prompt" != "unten" ]; do
done
echo "##################"
echo "Installing dependencies via pip: pifacecommon pifacedigitalio"
pip install pifacecommon pifacedigitalio paho-mqtt
PIP_DEP=(pifacecommon pifacedigitalio paho-mqtt)
echo "Installing dependencies via pip: ${PIP_DEP[*]}"
pip install "${PIP_DEP[@]}"
echo "Enabling and starting systemd-Services"
systemctl daemon-reload

View File

@ -108,6 +108,7 @@ class Foodoord:
self.status_open = False
self.mqtt = FoodoorMQTT("oben")
self.pifacedigital = pifacedigitalio.PiFaceDigital()
self.listener = pifacedigitalio.InputEventListener()
self.listener.register(self.DOOR_BELL, pifacedigitalio.IODIR_RISING_EDGE, self.doorbell, settle_time=10)
self.listener.register(self.CLOSE_BUTTON, pifacedigitalio.IODIR_RISING_EDGE, self.close_button, settle_time=5)
@ -137,15 +138,15 @@ class Foodoord:
def set_led(self, color):
for led, gpio in self.LEDS.items():
if color & led:
pifacedigital.leds[gpio].turn_on()
self.pifacedigital.leds[gpio].turn_on()
else:
pifacedigital.leds[gpio].turn_off()
self.pifacedigital.leds[gpio].turn_off()
def doorbell(self, event):
if self.status_open:
pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
time.sleep(2)
pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
def close_button(self, _event):
self.status_open = False
@ -156,7 +157,6 @@ class Foodoord:
self.mqtt.connect()
self.listener.activate()
pifacedigital = pifacedigitalio.PiFaceDigital()
signal.signal(signal.SIGTERM, self.signal_handler)
# Start settings
@ -176,18 +176,18 @@ class Foodoord:
pipe_cmd = ssh_input.readline().strip()
if pipe_cmd == "close" and self.status_open:
pifacedigital.relays[self.RELAYS_LOCK].toggle()
self.pifacedigital.relays[self.RELAYS_LOCK].toggle()
time.sleep(1)
pifacedigital.relays[self.RELAYS_LOCK].toggle()
self.pifacedigital.relays[self.RELAYS_LOCK].toggle()
self.status_open = False
self.update_api(True)
self.set_led(self.RED)
elif pipe_cmd == "open":
pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
time.sleep(2)
pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
self.pifacedigital.relays[self.RELAYS_UNLOCK].toggle()
if not self.status_open:
self.update_api(False)