You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an idea for an plugin but I'm to stupid for python programming! :-(
On my fermentation controller I have an HDMI screen on it.
It would be cool to trigger screen on with a timer via an GPIO input.
I have an PIR Sensor in my brewery, and with an coupling relay I clould also trigger an GPIO input for the hdmi screen.
I already found a solution on github, but as already mentioned, I'm not able to pack this into an cbpi plugin!
Maybe some of you have time for it and also interested in this:
while True:
time.sleep(0.5)
movement = GPIO.input(11)
if movement:
if timer:
print "canceler timer"
timer.cancel()
timer = False
if not monitor_is_on:
print "Taender skaerm"
monitor_on()
else:
if not timer:
print "starter timer"
timer = Timer(60*5, monitor_off)
timer.start()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have an idea for an plugin but I'm to stupid for python programming! :-(
On my fermentation controller I have an HDMI screen on it.
It would be cool to trigger screen on with a timer via an GPIO input.
I have an PIR Sensor in my brewery, and with an coupling relay I clould also trigger an GPIO input for the hdmi screen.
I already found a solution on github, but as already mentioned, I'm not able to pack this into an cbpi plugin!
Maybe some of you have time for it and also interested in this:
https://gist.github.com/fasmide/8106296
two parameters in the settings would be great, one for the GPIO Input Trigger and one for the ScreenOnTime.
import RPi.GPIO as GPIO
import time
from threading import Timer
import subprocess
GPIO.setmode(GPIO.BCM)
GPIO.setup(11, GPIO.IN)
timer = False
monitor_is_on = True
def monitor_off():
global monitor_is_on
subprocess.call(['/opt/vc/bin/tvservice', '-o'])
monitor_is_on = False
def monitor_on():
global monitor_is_on
subprocess.call(['/opt/vc/bin/tvservice', '-p'])
subprocess.call(['fbset -depth 8'], shell=True)
subprocess.call(['fbset -depth 16'], shell=True)
subprocess.call(['xrefresh'], shell=True)
monitor_is_on = True
while True:
time.sleep(0.5)
movement = GPIO.input(11)
if movement:
if timer:
print "canceler timer"
timer.cancel()
timer = False
if not monitor_is_on:
print "Taender skaerm"
monitor_on()
else:
if not timer:
print "starter timer"
timer = Timer(60*5, monitor_off)
timer.start()
Thanks,
Daniel
Beta Was this translation helpful? Give feedback.
All reactions