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 933 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.
    • S Offline
      sdetweil @Chazzer
      last edited by sdetweil

      @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 Reply Quote 0
      • C Offline
        Chazzer @sdetweil
        last edited by

        @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 Reply Quote 0
        • S Offline
          sdetweil @Chazzer
          last edited by

          @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

            @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 Reply Quote 0
            • C Offline
              Chazzer @Chazzer
              last edited by

              @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 Reply Quote 0
              • S Offline
                sdetweil @Chazzer
                last edited by sdetweil

                @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
                • 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