MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. greatm8nate
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    G
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 0

    greatm8nate

    @greatm8nate

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    greatm8nate Unfollow Follow

    Latest posts made by greatm8nate

    • Setting up auto display off during the night.

      It seems that in recent months the commands used to control HDMI out on the Raspberry Pi have changed. Most guides I’ve found online do not work anymore.

      I just want to turn my display off at 8pm and turn it back on at 8am.
      So I set up a cron job;

      20 14 * * * pm2 stop mm 
      21 14 * * * WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --off
      22 14 * * * WAYLAND_DISPLAY="wayland-1" wlr-randr --output HDMI-A-1 --on
      23 14 * * * wlr-randr --output HDMI-A-1 transform 270
      24 14 * * * pm2 start mm
      

      The timing is one minute apart for testing.
      Line 1 stops magic mirror.
      Line 2 should turn the display off.
      Line 3 turns it back on.
      Line 4 correct the screen orientation to portrait (it is not saved).
      Line 5 restarts the software.

      That command on line 2 works when manually typed into the terminal, but the cron job cannot execute it for some reason. Here is the error log I collected for lines 2-4;

      error: XDG_RUNTIME_DIR is invalid or not set in the environment.
      failed to connect to display
      

      As far as I have researched, the cron job is not in the same environment as me (the user), so it cannot execute this command. How to I make the cron job write as if I am typing the command into the terminal?

      posted in Troubleshooting
      G
      greatm8nate