• 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-Remote-Control](v2-dev) Extensible REST API, Dynamic Menus, and Socket Communications, plus other updates

Scheduled Pinned Locked Moved Development
76 Posts 13 Posters 47.2k Views 13 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.
  • B Offline
    bolish
    last edited by Mar 26, 2019, 10:09 AM

    @Cr4z33
    So, the ouput you got in the terminal by sending the “pow 0” command is in line with what is written into node helper.js line 610 / 620?

    C 1 Reply Last reply Mar 26, 2019, 10:12 AM Reply Quote 0
    • C Offline
      Cr4z33 @bolish
      last edited by Mar 26, 2019, 10:12 AM

      @bolish yep 100% that’s why I tried reporting that to @shbatm , but he didn’t reply about that yet. :grimacing_face:

      1 Reply Last reply Reply Quote 0
      • B Offline
        bolish
        last edited by Mar 26, 2019, 10:15 AM

        @Cr4z33
        Strange, it worked for me… FMI, what output do you get in the terminal with “echo pow 0 | cec-client -s -d 1”.
        When the screen is ON? When the screen is “OFF”?

        C 1 Reply Last reply Mar 26, 2019, 10:19 AM Reply Quote 0
        • C Offline
          Cr4z33 @bolish
          last edited by Mar 26, 2019, 10:19 AM

          @bolish depending wheter the TV is on or off it says power status: on or power status: standby.

          1 Reply Last reply Reply Quote 0
          • B Offline
            bolish
            last edited by Mar 26, 2019, 10:22 AM

            @Cr4z33 same as me…let’s try to cross check our node helper .js to see if they are written the same on line 610 and 620.

            C 1 Reply Last reply Mar 26, 2019, 10:27 AM Reply Quote 0
            • C Offline
              Cr4z33 @bolish
              last edited by Mar 26, 2019, 10:27 AM

              @bolish wait cannot remember if I am using perhaps the developer version, but line numbers are different.

              Mine are 601 (on), 604 (off) and 607 (status).

              1 Reply Last reply Reply Quote 0
              • B Offline
                bolish
                last edited by bolish Mar 26, 2019, 10:33 AM Mar 26, 2019, 10:31 AM

                This is what I did on my side :

                            if (["MONITORTOGGLE", "MONITORSTATUS", "MONITORON"].indexOf(action) !== -1) {
                                screenStatus = exec(monitorStatusCommand, opts, (error, stdout, stderr) => {
                                    if (stdout.indexOf("TV is off") !== -1 || stdout.indexOf("false") !== -1) { // REPLACE "TV is off" or "false" by "power status: standby"
                                        // Screen is OFF, turn it ON
                                        status = "off";
                                        if (action === "MONITORTOGGLE" || action === "MONITORON") {
                                            exec(monitorOnCommand, opts, (error, stdout, stderr) => {
                                                this.checkForExecError(error, stdout, stderr, res, { monitor: "on" });
                                            });
                                            this.sendSocketNotification("USER_PRESENCE", true);
                                            return;
                                        }
                                    } else if (stdout.indexOf("HDMI") !== -1 || stdout.indexOf("true") !== -1) { // REPLACE "HDMI" OR "true" by "power status: on"
                                        // Screen is ON, turn it OFF
                                        status = "on";
                                        if (action === "MONITORTOGGLE") {
                                            this.monitorControl("MONITOROFF", opts, res);
                                            return;
                

                At least this is what worked for me.

                C 1 Reply Last reply Mar 26, 2019, 10:34 AM Reply Quote 0
                • C Offline
                  Cr4z33 @bolish
                  last edited by Mar 26, 2019, 10:34 AM

                  @bolish what about the previous lines?

                  I thought that was the part to edit by replacing monitor commands with HDMI CEC ones like mines?

                          monitorControl: function(action, opts, res) {
                              let status = "unknown";
                              let monitorOnCommand = (this.initialized && "monitorOnCommand" in this.thisConfig.customCommand) ?
                                  this.thisConfig.customCommand.monitorOnCommand :
                                  "echo on 0 | cec-client -s -d 1";
                              let monitorOffCommand = (this.initialized && "monitorOffCommand" in this.thisConfig.customCommand) ?
                                  this.thisConfig.customCommand.monitorOffCommand :
                                  "echo standby 0 | cec-client -s -d 1";
                              let monitorStatusCommand = (this.initialized && "monitorStatusCommand" in this.thisConfig.customCommand) ?
                                  this.thisConfig.customCommand.monitorStatusCommand :
                                  "echo pow 0 | cec-client -s -d 1";
                  
                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    bolish
                    last edited by Mar 26, 2019, 10:38 AM

                    No. From my understanding, you only need to modify the customcommands into your config file not in the node.js.

                    The one you mention into your post (extract of node.js) are the default ones, don’t modify them.

                    What you need to modify into node.js are the ouput conditions as I posted above because the way the node.js is written (and how it’s explained on git) those commands will only work if your ouput are :

                    customCommand: {
                            monitorOnCommand: 'shell command to turn on your monitor',
                            monitorOffCommand: 'shell command to turn off your monitor',
                            monitorStatusCommand: 'shell command to return status of monitor, must return either "HDMI" or "true" if screen is on; or "TV is Off" or "false" if it is off to be recognized'
                        }
                    

                    That’s why we need to replace those conditions into the node.js by the one we get with our TV’s (which are different than the “true” / “flase” “TV is on” etc… but are “power status : stand by” and “power status: on”).

                    Clear now??

                    C 1 Reply Last reply Mar 26, 2019, 10:41 AM Reply Quote 0
                    • C Offline
                      Cr4z33 @bolish
                      last edited by Cr4z33 Mar 26, 2019, 10:43 AM Mar 26, 2019, 10:41 AM

                      @bolish sorry, but it is quite hard to get the difference for me lol. :smiling_face_with_open_mouth_cold_sweat:

                      Do you mind doing please a pastebin of your edited node_helper.js so that I can try it out?

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 8
                      • 5 / 8
                      5 / 8
                      • First post
                        50/76
                        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