Plugin Idea: Trigger HDMI Screen on GPIO Input #6
daniel-fraubaum
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
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