Closed samazaphikel closed 4 years ago
Hallo,
ich nochmal.
Ich habe es nun über Plugins gelöst. Falls es sonst noch jemand benötigt. Ich nutze den Raspberry 4 mit dem Raspberry Pi 7" Touchscreen Display
Ich habe einen Ordner displaycontrol in plugins erstellt mit der Datei displaycontrol.py. In der config.ini habe ich unter [Plugins] die Zeile displaycontrol= 1 eingefügt In der displaycontrol.py habe ich dann folgendes Script:
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging # Global logger
import time
import os
#
#
# onLoad (init) function of plugin
# will be called one time by the pluginLoader on start
#
def onLoad():
# nothing to do for this plugin
return
#
#
# will be called by the alarmHandler
#
def run(typ, freq, data):
try:
# display on
os.system("sudo -E sh -c 'echo 0 > /sys/class/backlight/rpi_backlight/bl_power'")
except:
logging.error("cannot turn the display on")
try:
# pause function
time.sleep(900) # pause in seconds
except:
logging.error("something wrong in sleep")
try:
# display off
os.system("sudo -E sh -c 'echo 1 > /sys/class/backlight/rpi_backlight/bl_power'")
except:
logging.error("cannot turn the display off")
Ich würde dann aber empfehlen die Plugin Ausführung auf Async zu stellen. So ist nämlich BOSWatch bis zur Abarbeitung dieses Plugins (Wartezeit) blockiert und es könnten Alarme verloren gehen.
Ok, und wie stelle ich sowas auf async?
siehe Kommentar Block darüber ... https://github.com/Schrolli91/BOSWatch/blob/master/config/config.template.ini#L41
Ah ok, Danke
Hi,
wo könnte ich einen subprocess einfügen, wenn eine RIC hereinkommt soll ein zusätzliches Bash script gestartet werden.
sowas wie z.B.:
In meinem Fall soll das Display vom Raspberry an und ausgeschalten werden