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.

    MM current version on Raspberry Pi 5 cannot turn off monitor

    Scheduled Pinned Locked Moved Solved Troubleshooting
    53 Posts 9 Posters 24.3k Views 9 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.
    • V Offline
      vvrangler
      last edited by

      Anyone using MM on a Raspberry Pi 5 or running a Raspberry Pi 5 in general know how to turn off the monitor now?

      I have been using MMM-Remote-Control and turning off/on the monitor using the following requests

      http://<MagicMirrorIPAddress>:8080/remote?action=MONITOROFF
      
      http://<MagicMirrorIPAddress>:8080/remote?action=MONITORON
      

      Which ultimately issue the commands

      vcgencmd display_power 0
      
      vcgencmd display_power 1
      

      but these commands, no longer work and are generating errors and not Turing the monitor off/on

      [30.12.2023 12:15.44.921] [ERROR] 
      [30.12.2023 12:15.44.927] [ERROR] Error: Command failed: vcgencmd display_power 0
      
          at ChildProcess.exithandler (node:child_process:430:12)
          at ChildProcess.emit (node:events:513:28)
          at maybeClose (node:internal/child_process:1091:16)
          at Process.onexit (node:internal/child_process:302:5) {
        code: 255,
        killed: false,
        signal: null,
        cmd: 'vcgencmd display_power 0'
      }
      [30.12.2023 12:15.47.731] [ERROR] 
      [30.12.2023 12:15.47.732] [ERROR] Error: Command failed: vcgencmd display_power 1
      
          at ChildProcess.exithandler (node:child_process:430:12)
          at ChildProcess.emit (node:events:513:28)
          at maybeClose (node:internal/child_process:1091:16)
          at Process.onexit (node:internal/child_process:302:5) {
        code: 255,
        killed: false,
        signal: null,
        cmd: 'vcgencmd display_power 1'
      }
      
      

      This is the command line result from outside of MM

      MMUser@MagicMirror:~ $ vcgencmd display_power 0
      vc_gencmd_read_response returned -1
      error=1 error_msg="Command not registered"
      
      

      Web searches for a solution have been unsuccessful.

      Thanks for any help you might be able to provide.

      karsten13K 1 Reply Last reply Reply Quote 0
      • karsten13K Offline
        karsten13 @vvrangler
        last edited by

        @vvrangler

        untested:

        wlr-randr --output HDMI-A-1 --off
        wlr-randr --output HDMI-A-1 --on
        

        instead of vcgencmd commands.

        See e.g. https://forums.raspberrypi.com/viewtopic.php?t=358689

        V 1 Reply Last reply Reply Quote 0
        • V Offline
          vvrangler @karsten13
          last edited by

          @karsten13 said in MM current version on Raspberry Pi 5 cannot turn off monitor:

          wlr-randr --output HDMI-A-1 --off

          @karsten13, I did try those commands and I receive this response to both

          MMUser@MagicMirror:~ $ wlr-randr --output HDMI-A-1 --off
          failed to connect to display
          
          
          karsten13K 1 Reply Last reply Reply Quote 0
          • karsten13K Offline
            karsten13 @vvrangler
            last edited by

            @vvrangler

            may wrong display, don’t no how the syntax is for the other HDMI port instead of HDMI-A-1 …

            V 1 Reply Last reply Reply Quote 0
            • V Offline
              vvrangler @karsten13
              last edited by

              @karsten13 I was not able to get any commands using the wlr-randr to show anything other than “failed to connect to display”, however, after much searching, I did find a command that was able to turn the screen off and on

              MMUser@MagicMirror:~ $ DISPLAY=:0.0 xrandr --output HDMI-1 --off
              
              MMUser@MagicMirror:~ $ DISPLAY=:0.0 xrandr --output HDMI-1 --mode 2560x1440 --rate 60 --rotate left
              
              

              Although I’m not sure how to get this into something that can be called from MagicMirror itself so that it can be run as a menu command in MMM-Remote-Control or some other way that it can be called from outside of MagicMirror

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                jbat66 @vvrangler
                last edited by

                @vvrangler
                You have to have MMM-Remote-Control installed, and in the config.js file you can put several custom commands that point to scripts on your machine.

                b2af707d-4ba7-41cd-a18f-0b0444b6e361-image.png

                Here is an example for two of them in my config.js.

                76a6c8de-ca47-464e-aae3-3df7137da659-image.png

                mm-manager.sh, is just a script I wrote to do things to my magic mirror, you scripts can be named what you want and just have the commands you want.

                V 1 Reply Last reply Reply Quote 0
                • V Offline
                  vvrangler @jbat66
                  last edited by

                  @jbat66 , @karsten13 , thank you for the help, I was able to get it going using the custom commands in MMM-Remote-Control

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    JohnGalt
                    last edited by

                    I’m having the same issues… I recently built a new MagicMirror instance using the latest Raspbian OS, and the commands I have used in prior instances don’t work in the new OS.

                    None of the commands listed above work for me. I have also tried the following in the crontab. While it DOES turn off the monitor display, the display turns itself back on in about 10 seconds…

                    display_off >/dev/null 2>&1
                    

                    Any help will be greatly appreciated, as the MagicMirror is in a location where running the display all night is disrupting people’s sleep, and having to manually turn it on and off is very inconvenient.

                    J 2 Replies Last reply Reply Quote 0
                    • J Offline
                      jbat66 @JohnGalt
                      last edited by

                      @JohnGalt I have a Pi 4, but have the latest OS, and I never have found a way to turn off the monitor. I have the same problem of the screen being too bright, so what I did was write a bash script, to turn off the background slide show, and to dim all the modules via the api into MMM-remote. I also have in my script just a hide all, and the screen goes blank, even tho the monitor is still on.

                      Here is how you can hide all modules
                      curl -X GET “$API_URL/api/module/all/hide” -H “accept: application/json”
                      the $API_URL, is your IP address. I use “http://localhost:8080”

                      I also wrote a script that will get the sunrise sunset times for the day and shut off my screen by hiding or diming all the modules at sunset, and then reverse that at sunrise.

                      let me know if you are interested. I need to put some of my stuff up on github. I’m just getting familiar with github, and have fixed a couple of modules for folks in the last week.

                      J 1 Reply Last reply Reply Quote 0
                      • J Offline
                        jbat66 @JohnGalt
                        last edited by

                        @JohnGalt Side note, I will buy someone a pizza, if I can get working commands to actually turn off and turn on my HDMI display. I think I have tried everything on the internet with no luck. I’m serious about the pizza!
                        :-)

                        S 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 3
                        • 4
                        • 5
                        • 6
                        • 1 / 6
                        • 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