@hoofta said in {HowTo} turn on/off your monitor (Time based, PIR/Button, App):
I have attempted to use the “screen_off/on” option original provided instead of the “monitor_on/off” but it doesn’t seem to be working properly.
As described u need to use the “pir.py” script from point 2.2.
But then (and i forgot to write that) u need to change the shell script names in the script or keep the “monitor_on” as name.
Sorry for my english, i hope u understand.
So, to help u out:
u already creates the “screen_on.sh” and “screen_off.sh”, right?
then u need to change the following lines in the “pir.py” script like this:
def turn_on():
subprocess.call("sh /home/pi/screen_on.sh", shell=True)
def turn_off():
subprocess.call("sh /home/pi/screen_off.sh", shell=True)
The idea to connect the power button of the TV to a relay is a good start. So u could save much money.
But then the relay must do an impulse instead of being on or off static.
To do this u could use the normal pir.py script from point 2.2 (without any changes).
But the content of both *.sh files should look like this:
nano monitor_on.sh :
gpio -g write 27 1
sleep 1
gpio -g write 27 0
nano monitor_off.sh :
gpio -g write 27 1
sleep 1
gpio -g write 27 0
chmod +x monitor_on.sh
chmod +x monitor_off.sh
Connect the relay with two wires parallel to the power button of your tv.
On the relay use “C” and “NO”