User avatar
JonnyAlpha
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 572
Joined: Sat Nov 02, 2013 2:06 pm

Waking a Monitor

Wed Dec 30, 2015 4:26 pm

Hi;

I am developing a project part of which starts a video playing the Pi detects movement using a PIR detector.
I have successfully written a short piece of code that plays a video when motion is detected but after a short while the monitor / Pi goes into sleep mode and when the monitor is blank the video does not wake up the monitor?

To get around this I need a way of waking up the monitor?

After Googling I found this page:

http://raspberrypi.stackexchange.com/qu ... creensaver

It suggests using this command:
xset s reset && xset dpms force on

I tried xset -q from a remote session over SSH and it returned -
xset: unable to open display ""

Do I need to name the display?
Raspberry Pi Certified Educator. Main Hardware - Raspberry Pi 1 model B revision 2, Raspberry Pi 2 model B, Pi Camera

User avatar
JonnyAlpha
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 572
Joined: Sat Nov 02, 2013 2:06 pm

Re: Waking a Monitor

Wed Dec 30, 2015 6:37 pm

SOLVED

Hi;

Did some more research and found the command 'tvservice'.
So 'tvservice -o' switches the monitor off and 'tvservice -p' switches it on, so I just need to create a bash script to switch the monitor on and call is using OS from within my python program.

Job Done - I think :-)
Raspberry Pi Certified Educator. Main Hardware - Raspberry Pi 1 model B revision 2, Raspberry Pi 2 model B, Pi Camera

Return to “Advanced users”