Which frame this applies to. This is the read-only half of the display-power story, and like its sibling, The new way to turn your connected HDMI monitor on and off, it needs a Wayland desktop session with a wlroots compositor — the pi3d PictureFrame build for the Pi 2, 3, 4 and 5. That article switches the screen; this one only asks what state it is in. Neither applies to picframe3 — see the last section.

The address of this page says xrandr because that was the X11 command everybody knew. The desktop has not been X11 since Bookworm, so xrandr returns nothing there; the Wayland equivalent is wlr-randr, which is what the rest of this page uses.

If you want to check the status of your display, you can now use the

wlr-randr

command.

The output will be similar to

HDMI-A-1 "HJW HDMI TO USB 0x00000001 (HDMI-A-1)"
  Physical size: 700x390 mm
  Enabled: no
  Modes:
    1920x1080 px, 60.000000 Hz (preferred)

giving you a clear feedback with “Enabled:” if the monitor is on or off.

(The name in that example, “HJW HDMI TO USB”, is an HDMI capture stick I had plugged in for testing rather than a monitor. On a real frame you will see your monitor’s own name there.)

You will also see many other display modes/resolutions and you can grab the information that you like from the output file.

I wrote a Python test script parsing the output and checking the display status.

#!/usr/bin/python3

import subprocess

def is_display_enabled():
    try:
        # Run the wlr-randr command and capture its output
        command = "wlr-randr"
        output = subprocess.check_output(command, shell=True).decode('utf-8')

        # Check if any display has "Enabled: yes" in the output
        for line in output.splitlines():
            if 'Enabled:' in line:
                enabled_status = line.split(':')[1].strip()
                if enabled_status.lower() == 'yes':
                    return True
        return False  # If no display is enabled
    except subprocess.CalledProcessError:
        # Handle any errors that may occur
        return False

if is_display_enabled():
    print("A display is on.")
else:
    print("All displays are off.")

I am using it to let Home Assistant know if my display is on or off.

On picframe3 you do not need this script

On my current frame there is no compositor, so wlr-randr is not installed and would have nothing to report if it were. picframe3 switches the panel itself through DRM DPMS and publishes its own state: with MQTT enabled it announces the frame to Home Assistant by discovery, and the display arrives there as a light entity that shows whether the screen is on and at what brightness. The same state is in /api/state over HTTP and on the picframe/picframe/state topic. No parsing of command output at all.