MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Having trouble with screen on and off? Here are some tips that could help

    Scheduled Pinned Locked Moved Tutorials
    20 Posts 8 Posters 16.8k Views 8 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      reviewsfornerds @mumblebaj
      last edited by

      @mumblebaj Thank you for this tutorial.

      I have been able to modify the MMM-Remote-Control config to use these commands for monitor on and off, and the command “/usr/bin/wlr-randr --output HDMI-A-1 --off” works in ssh terminal, however the log file shows the error “failed to connect to display” when running this as a cron job.

      Would you have any insight as to what I could do? What would I need to provide in order for you to assist?

      I am on Wayland desktop

      mumblebajM S 2 Replies Last reply
      Reply Quote 1
      • mumblebajM
        mumblebaj Module Developer @reviewsfornerds
        last edited by

        @reviewsfornerds Hi. Apologies for the late reply. Was away for the weekend.

        Can you share your script that you are calling? Also the output of wlr-randr.

        Check out my modules at: https://github.com/mumblebaj?tab=repositories
        Check my blog-post: https://mumblebaj.xyz/
        Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

        1 Reply Last reply
        Reply Quote 0
        • S
          sdetweil @reviewsfornerds
          last edited by

          @reviewsfornerds said in Having trouble with screen on and off? Here are some tips that could help:

          the log file shows the error “failed to connect to display”

          yes, the command wants to know WHICH ‘display’ you want to control
          and normally would get that from the environment variables of the terminal window you are running the command in

          BUT

          the module is running it in the background, with NO window, no env variable… oops…

          IN addition, ‘specifying’ the window info may not work as the environment running the wlr_randr command was NOT started UNDER the window manager

          how to fix THAT is beyond my knowledge… as each of these depends on different stuff…
          (and you put it in cron, and cron runs as ROOT, not the local user you would be if you had a terminal window… even more fun)

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply
          Reply Quote 0
          • C
            captsi
            last edited by

            Thank you for the tutorial, it solved my issues of sending the screen to sleep at night. For whatever reasons, I had to use wayland-0 and HDMI-A-2 on my installation.

            mumblebajM S 2 Replies Last reply
            Reply Quote 1
            • mumblebajM
              mumblebaj Module Developer @captsi
              last edited by

              @captsi HDMI-A-2 is probably because you plugged into 2. Glad it helped you though.

              Check out my modules at: https://github.com/mumblebaj?tab=repositories
              Check my blog-post: https://mumblebaj.xyz/
              Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

              1 Reply Last reply
              Reply Quote 0
              • S
                sdetweil @captsi
                last edited by

                @captsi said in Having trouble with screen on and off? Here are some tips that could help:

                I had to use wayland-0 and HDMI-A-2

                wayland is the software screen interface,
                HDMI- is the hardware screen interface

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply
                Reply Quote 0
                • L
                  langejos @mumblebaj
                  last edited by

                  @mumblebaj

                  Works great, but when the monitor switches back on, chromium does not start maximized and shows the infobar, both of which are managed in the [autostart] section of wayfire.ini. Is there a way to get the MM display back just as when the Pi launches fresh?

                  S mumblebajM 2 Replies Last reply
                  Reply Quote 0
                  • S
                    sdetweil @langejos
                    last edited by

                    @langejos switch back to x11 in raspi-config

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    L 1 Reply Last reply
                    Reply Quote -1
                    • G
                      Gejakem
                      last edited by

                      For me I needed to use wayland-0 on a RPI5 using the ribbon-display cable.
                      From the wlr-randr i got this

                      DSI-1 “(null) (null) (DSI-1)”
                      Physical size: 154x86 mm
                      Enabled: yes
                      Modes:
                      800x480 px, 60.028999 Hz (preferred, current)
                      Position: 368,332
                      Transform: 90
                      Scale: 1.000000

                      So I used DSI-1 instead of HDMI.
                      Also I removed the --mode information since i got something like “Mode 800x480 not recognized”, but apparently my display defaults to that.

                      1 Reply Last reply
                      Reply Quote 0
                      • BKeyportB
                        BKeyport Module Developer @mumblebaj
                        last edited by

                        @mumblebaj Course, I just switched back to X11 for now. 🙃

                        The “E” in “Javascript” stands for “Easy”

                        1 Reply Last reply
                        Reply Quote 0
                        • mumblebajM
                          mumblebaj Module Developer @langejos
                          last edited by

                          @langejos I am assuming you ran wlr-randr prior to creating the scripts to obtain your mirrors current display settings and then using that as input in the mon.sh?

                          Check out my modules at: https://github.com/mumblebaj?tab=repositories
                          Check my blog-post: https://mumblebaj.xyz/
                          Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                          1 Reply Last reply
                          Reply Quote 0
                          • R
                            reviewsfornerds
                            last edited by

                            Hello all and thank you for all the suggestions. I apologize as I never got followup notifications of your responses.

                            I ended up reverting back to the original desktop as I did not feel like fighting to change everything.

                            Again, thank you all for your time and help.

                            1 Reply Last reply
                            Reply Quote 0
                            • L
                              langejos @sdetweil
                              last edited by

                              @sdetweil Yes, I did! I tried switching to x-11 and adjusting all parameters, but ended up switching back to wayland which works fine with a scheduled shut-down in the evening. Thank you once again for taking the time to lead me through this!

                              1 Reply Last reply
                              Reply Quote 1
                              • mumblebajM mumblebaj referenced this topic on
                              • karsten13K karsten13 referenced this topic on
                              • mumblebajM mumblebaj referenced this topic on
                              • mumblebajM mumblebaj referenced this topic on
                              • mumblebajM mumblebaj referenced this topic on
                              • mumblebajM
                                mumblebaj Module Developer @mumblebaj
                                last edited by

                                For users who are having issues with monitor on and monitor off and looking for a cron job to start their wayland setup. See my original post with updates.

                                Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                Check my blog-post: https://mumblebaj.xyz/
                                Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                                1 1 Reply Last reply
                                Reply Quote 0
                                • 1
                                  1a2a3a @mumblebaj
                                  last edited by

                                  @mumblebaj hey, do you know why my off job when i triggered it either manually or via the cron job, it turns the monitor off, but after a few seconds it turns it on immediately again…?

                                  mumblebajM 1 Reply Last reply
                                  Reply Quote 0
                                  • mumblebajM
                                    mumblebaj Module Developer @1a2a3a
                                    last edited by

                                    Hi @1a2a3a . Honestly, no idea. I remember seeing a few posts from people having that exact same issue. Maybe if you search the forum for related content you may find something. I have not had the same issue myself.

                                    Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                    Check my blog-post: https://mumblebaj.xyz/
                                    Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                                    1 1 Reply Last reply
                                    Reply Quote 0
                                    • 1
                                      1a2a3a @mumblebaj
                                      last edited by

                                      @mumblebaj I found this old thread of mine - https://forum.magicmirror.builders/topic/18318/mm-current-version-on-raspberry-pi-5-cannot-turn-off-monitor/32?page=4

                                      Did you input the vc4 hot plug command?

                                      mumblebajM 2 Replies Last reply
                                      Reply Quote 0
                                      • mumblebajM
                                        mumblebaj Module Developer @1a2a3a
                                        last edited by

                                        @1a2a3a I am a little confused. I am not having any issues after implementing my solution in this post. I thought you were having issues.

                                        Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                        Check my blog-post: https://mumblebaj.xyz/
                                        Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                                        1 Reply Last reply
                                        Reply Quote 0
                                        • mumblebajM
                                          mumblebaj Module Developer @1a2a3a
                                          last edited by mumblebaj

                                          @1a2a3a For the latest Wayland on off I use the new adjusted scripts.

                                          mon.sh

                                          #!/bin/bash
                                          export WAYLAND_DISPLAY=wayland-0
                                          export XDG_RUNTIME_DIR=/run/user/1000
                                          /usr/bin/wlr-randr --output HDMI-A-1 --on --mode 1920x1080@60Hz --transform 270
                                          

                                          mof.sh

                                          #!/bin/bash
                                          export WAYLAND_DISPLAY=wayland-0
                                          export XDG_RUNTIME_DIR=/run/user/1000
                                          /usr/bin/wlr-randr --output HDMI-A-1 --off
                                          

                                          This works pretty well for me. The screen eventually times out as there is no input and it turns off.

                                          In addition to these I have these cron entries to call the scripts.

                                          Turns the screen on at 6am and off at 9pm.

                                          00 06 * * * /home/pi/mon.sh >> /home/pi/mon.log 2>&1
                                          00 21 * * * /home/pi/mof.sh >> /home/pi/mof.log 2>&1
                                          

                                          Check out my modules at: https://github.com/mumblebaj?tab=repositories
                                          Check my blog-post: https://mumblebaj.xyz/
                                          Check my MM Container: https://hub.docker.com/repository/docker/mumblebaj/magicmirror/general

                                          1 Reply Last reply
                                          Reply Quote 0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          • 1 / 1
                                          • First post
                                            Last post
                                          Enjoying MagicMirror? Please consider a donation!
                                          MagicMirror created by Michael Teeuw.
                                          Forum managed by Sam, technical setup by Karsten.
                                          This forum is using NodeBB as its core | Contributors
                                          Contact | Privacy Policy