• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

MMM-Alexa Control with monitortoggle true -- but these command not work

Scheduled Pinned Locked Moved Solved Troubleshooting
7 Posts 2 Posters 551 Views 2 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.
  • C Offline
    Chazzer
    last edited by Chazzer Oct 24, 2023, 1:13 PM Oct 24, 2023, 12:57 PM

    Hello everyone, and a big thank you to the developer of Alexa Control. I’ve successfully installed it, and the Alexa commands are being recognized.

    Is it possible to ask Alexa to refresh or initialize the commands?

    Additionally, I’ve been testing the monitor on/off mode. Here’s what I’ve observed: I need to set the DISPLAY environment variable first using “export DISPLAY=:0,” and then the “xrandr” command works.

    The monitor can be turned off via SSH using the command “xrandr --output HDMI-1 --off” successfully. However, it’s not possible to turn it back on with “xrandr --output HDMI-1 --on.” To turn the monitor back on, I need to use “xxx@raspberrypi:~/MagicMirror $ xrandr --output HDMI-1 --auto --rotate right” because the monitor rotates to the left. Can you please assist me in developing a solution to control this via Alexa?

    As additional information, I am using a Raspberry Pi 3B with a 32GB SD card, and I have a 17.3-inch LED display with a matte finish that is compatible with the B173RW01 V.4 TOP NHD. To go along with this, I am using the controller: HDMI VGA AV USB LCD Control Panel for 17.3-inch LP173WD1 B173RW01 LTN173KT01-A01 N173FGE-L21 N17306-L02 1600x900 with a 40-pin LCD screen.

    S 1 Reply Last reply Oct 24, 2023, 1:02 PM Reply Quote 0
    • S Offline
      sdetweil @Chazzer
      last edited by sdetweil Oct 24, 2023, 1:17 PM Oct 24, 2023, 1:02 PM

      @Chazzer you will have to edit the node helper and add another option, xrandr, with the appropriate commands

      this module doesn’t allow you to configure the actual commands used.

      in node_helper.js replicate this block (line 249)

                  else if(this.config.vcgencmd =='tvservice'){
                      device.handler = function(action) {     
                          if(action === 1){
                              exec("tvservice --preferred", opts, (error, stdout, stderr) => {
                                  _this.checkForExecError(error, stdout, stderr);
                              });
                          }if(action === 0){
                              exec("tvservice --off", opts, (error, stdout, stderr) => {
                                  _this.checkForExecError(error, stdout, stderr);
                              });
                          }
                      }
                  }
      

      change this

                 else if(this.config.vcgencmd =='tvservice'){
      

      to

                 else if(this.config.vcgencmd =='xrandr'){
      

      and then change the two exec’s to the xrandr commands you documented…

      then change the config.js option for vcgencmd to ‘xrandr’

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      C 2 Replies Last reply Oct 24, 2023, 1:16 PM Reply Quote 0
      • C Offline
        Chazzer @sdetweil
        last edited by Oct 24, 2023, 1:16 PM

        @sdetweil
        Hi Sam, thanks for your quick help. I’m starting to get a bit anxious. I’m not sure if I can do this and would really appreciate a step-by-step guide. I’m afraid I might mess things up if it goes wrong.

        Can you explain how to make a backup of the Magic Mirror on the Raspberry Pi? My head is spinning with all these thoughts. Go take Timmy for a walk!

        S 1 Reply Last reply Oct 24, 2023, 1:18 PM Reply Quote 0
        • S Offline
          sdetweil @Chazzer
          last edited by Oct 24, 2023, 1:18 PM

          @Chazzer backup see my scripts
          https://github.com/sdetweil/MagicMirror-backup-restore

          and changes, see the post above yours…

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • C Offline
            Chazzer @sdetweil
            last edited by sdetweil Oct 24, 2023, 3:37 PM Oct 24, 2023, 3:23 PM

            @sdetweil
            Dear Sam, I wanted to express my heartfelt thanks. I’ve duplicated the entry and made all the settings accordingly. I must say, I’m thrilled! Alexa can now turn off and on the monitor. I’ll paste in the code snippet shortly.

            else if(this.config.vcgencmd =='xrandr'){
                            device.handler = function(action) {     
                                if(action === 1){
                                    exec("xrandr --output HDMI-1 --auto --rotate right", opts, (error, stdout, stderr) => {
                                        _this.checkForExecError(error, stdout, stderr);
                                    });
                                }if(action === 0){
                                    exec("xrandr --output HDMI-1 --off", opts, (error, stdout, stderr) => {
                                        _this.checkForExecError(error, stdout, stderr);
                                    });
                                }
                            }
                        }
            

            now, if you had made a fork, downloaded this fork, changed and used git to commit , and push, you could have contributed this as a pull request for the author to add, so that others could benefit too…

            one minor thing, the code block markers MUST be the first thing on the line

            C 1 Reply Last reply Oct 24, 2023, 3:46 PM Reply Quote 0
            • C Offline
              Chazzer @Chazzer
              last edited by Oct 24, 2023, 3:46 PM

              @Chazzer said in MMM-Alexa Control with monitortoggle true -- but these command not work:

              @sdetweil
              Dear Sam, I wanted to express my heartfelt thanks. I’ve duplicated the entry and made all the settings accordingly. I must say, I’m thrilled! Alexa can now turn off and on the monitor. I’ll paste in the code snippet shortly.

              else if(this.config.vcgencmd =='xrandr'){
                              device.handler = function(action) {     
                                  if(action === 1){
                                      exec("xrandr --output HDMI-1 --auto --rotate right", opts, (error, stdout, stderr) => {
                                          _this.checkForExecError(error, stdout, stderr);
                                      });
                                  }if(action === 0){
                                      exec("xrandr --output HDMI-1 --off", opts, (error, stdout, stderr) => {
                                          _this.checkForExecError(error, stdout, stderr);
                                      });
                                  }
                              }
                          }
              

              now, if you had made a fork, downloaded this fork, changed and used git to commit , and push, you could have contributed this as a pull request for the author to add, so that others could benefit too…

              > one minor thing, the code block markers MUST be the first thing on the line

              Hello Sam, I’m really a newcomer to the world of Linux and Magic Mirror! :-) The developer seems informed, already through my first forum post, and I’ve already sent him the corresponding code snippet. I don’t quite understand if the code is faulty. Could you please show me what you mean by “one minor thing, the code block markers MUST be the first thing on the line”?

              S 1 Reply Last reply Oct 24, 2023, 3:49 PM Reply Quote 0
              • S Offline
                sdetweil @Chazzer
                last edited by sdetweil Oct 24, 2023, 3:50 PM Oct 24, 2023, 3:49 PM

                @Chazzer on your post, which I edited, the code marker was on a line following the word shortly,

                so the code block did not expand

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  6/7
                  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