From 1941698a52bb0f50ac6742dd9d55a0875c7f7d88 Mon Sep 17 00:00:00 2001 From: T Date: Tue, 14 Jan 2025 19:04:13 +0100 Subject: [PATCH] Bug Fix --- build-package | 2 +- debian/DEBIAN/control | 4 ++-- debian/DEBIAN/postinst | 5 +++-- debian/usr/sbin/foodoord_oben | 18 +++++++++--------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/build-package b/build-package index 95969eb..05cf0a7 100755 --- a/build-package +++ b/build-package @@ -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" diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control index e7f64fd..acd044c 100755 --- a/debian/DEBIAN/control +++ b/debian/DEBIAN/control @@ -1,6 +1,6 @@ Package: foodoord -Version: 3.3.0 -Maintainer: Bandie , Tobi +Version: 3.3.1 +Maintainer: Tobi Architecture: all Description: Control the doors of the club, ja! Depends: dash, git, python3, pip, tmux diff --git a/debian/DEBIAN/postinst b/debian/DEBIAN/postinst index b779922..09c49aa 100755 --- a/debian/DEBIAN/postinst +++ b/debian/DEBIAN/postinst @@ -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 diff --git a/debian/usr/sbin/foodoord_oben b/debian/usr/sbin/foodoord_oben index 3ccdbcf..1f5937d 100755 --- a/debian/usr/sbin/foodoord_oben +++ b/debian/usr/sbin/foodoord_oben @@ -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)