This is the older software
These instructions are for Pi3D PictureFrame, which is still the right choice on a Raspberry Pi 2, 3 or Zero 2 W. On a Pi 4 or 5, start with the 2026 guide instead.
Tested with
Raspberry Pi OS Bookworm desktop with the labwc compositor on a Raspberry Pi 4 (Nov 2024). Not re-tested since, and it does not apply to picframe3, which has no compositor.
I recently received an email from a reader telling me that there was a problem.
The long-serving command vcgencmd display_power 1/0 wouldn’t work with the latest Raspberry Pi operating system update.
I have written a post here to explain several ways to automatically turn your Raspberry Pi digital picture frame on and off at fixed times or simply with a Terminal command.
Which frame this applies to. Everything below needs a Wayland desktop session with a wlroots compositor (wayfire or labwc). That is the pi3d PictureFrame build for the Pi 2, 3, 4 and 5. It does not apply to picframe3, my current build for the Pi 4 and Pi 5. picframe3 runs on Raspberry Pi OS Lite and draws straight onto DRM/KMS, so there is no compositor for wlr-randr to talk to at all. It switches the panel itself, and it has a screen-off schedule in its own settings under “when the screen turns off”.
This article is about changing the display state. If you want to read it, that is the companion piece, Determine the power status of a connected display.
Death by consensus
It turns out that the vcgencmd command had been retired and moved to the graveyard of commands that we used a lot but, for some inexplicable reason, had to die a cruel death because some code maintainers decided it was time.
What replaced it was Wayland. Raspberry Pi Ltd made Wayland the default with Bookworm in October 2023, using the wayfire compositor, and switched the default compositor to labwc in the October 2024 update.
That changed all the commands. One note on the address of this page: it says xrandr, and xrandr is the X11 tool. The desktop has not been X11 since Bookworm, so xrandr does nothing there. The command that replaced it under a wlroots compositor is wlr-randr, and that is what every example below uses.
A new hope
Provided you are running a Raspberry Pi 2/3/4/5 on the Raspberry Pi OS desktop image, Bookworm or Trixie, you can use the following Terminal command to turn your connected HDMI monitor (the left output of the two) off:
wlr-randr --output HDMI-A-1 --off
To turn it on again, type:
wlr-randr --output HDMI-A-1 --on
You can name the mode as well, so the screen comes back at the resolution you want. So in the case of a 4K display, you would write (change the resolution to your monitor):
wlr-randr --output HDMI-A-1 --on --mode 3840x2160
Here is what the Python script for turning the monitor off would look like:
#!/usr/bin/python3
# coding: utf8 #
import subprocess # for command execution
def turn_off_monitor():
try:
subprocess.call("wlr-randr --output HDMI-A-1 --off", shell=True)
print("Monitor HDMI-A-1 turned off successfully.")
except Exception as e:
print(f"An error occurred: {e}")
turn_off_monitor()
And for turning it on:
#!/usr/bin/python3
# coding: utf8 #
import subprocess # for command execution
def turn_on_monitor():
try:
subprocess.call("wlr-randr --output HDMI-A-1 --on --mode 3840x2160", shell=True)
print("Monitor HDMI-A-1 turned on successfully.")
except Exception as e:
print(f"An error occurred: {e}")
turn_on_monitor()
The missing display status
The vcgencmd returned a “0” or “1” depending on the monitor being off or on.
With Wayland type
wlr-randr
and it will return a value like
Enabled: yes (or no)
depending on the display status.
On picframe3 there is nothing to install
On my current frame there is no compositor, so none of this applies. picframe3 turns the panel on and off through DRM DPMS itself. You get at it from the web interface, from Home Assistant (the frame appears as a light you can switch and dim), by pressing o on a keyboard plugged into the Pi, or over MQTT on picframe/picframe/display/set with on or off. For fixed times, the power.schedule setting takes something like all: ["23:00-07:00"], and power.dim_schedule dims in the evening instead of switching off. Nothing to install, and nothing to write a cron job for.
Was this article helpful?
Thank you for your support and motivation.