7

I have my Raspbian running Chromium in kiosk mode and works nicely. However, I would like it to turn the HDMI display off at 10pm and wake it up at 7am. I could not find such a setting in Raspbian.

5

I am using xset dpms force off to turn off the display. This command uses Display Power Management Signaling.

In a cron job, you'll need to set the DISPLAY variable, so that the crontab entries become something like:

*   22  *   *   *   DISPLAY=:0 xset dpms force off
*   7   *   *   *   DISPLAY=:0 xset dpms force on

Make sure the X server is started with -dpms.

  • 1
    This will run every minute of 22h and 7h. @andré-düwel's answer configures the cronjob to run at 22:00 and 7:00 and better answers the original question. – Chadi Mar 1 at 7:24
  • @Chadi Running repeatedly might be better if, for example, the device was turned off at 7 am. – megaflop Apr 10 at 10:12
5

You may want to look into HDMI CEC which allows you to send commands such as power on/off via HDMI to a TV set. There's a libcec for this, as well as an cec-client. For instance, this blog post about switching on/off a TV may help: https://timleland.com/raspberry-pi-turn-tv-onoff-cec/

Then set up a cron job to run cec-client in the evening and the morning.

  • Unfortunately I am using a monitor which is not CEC compatible. – Kashif Jun 6 '17 at 2:34
  • Maybe you should add relevant commands to your answer. – Dmitry Grigoryev Jan 18 at 9:38
3

Like Steffen Uhlig wrote, using xset dpms force [on|off] is the solution for normal displays. Please note that his cronjob is running every minute in the specified hour.

crontab -e (as normal pi user) will allow you to add a cronjob, where you just need to add the following lines at the end:

0   22  *   *   *   DISPLAY=:0 xset dpms force off
0   7   *   *   *   DISPLAY=:0 xset dpms force on
  • Good find. This should really be a comment to the answer you refer to, but I know you can't post comments yet. – Dmitry Grigoryev Jan 18 at 9:28
  • thats my problem, feel free to add the comment to the accepted answer or suggest an edit :) – André Düwel Jan 18 at 16:46
  • I added that to my cron: off at 22 and on at 07. To make a try, from command line I executed the off command, it worked. Then I executed the on, also worked but after a while the display turned off again. Second time executed on command and again display turned off after a while. Don't realize why – dstonek May 28 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.