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 {fix monitor on/off} tvservice --> vcgencmd

    Scheduled Pinned Locked Moved Solved Troubleshooting
    moduleremote controlmonitor ontvservice
    2 Posts 1 Posters 1.6k 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.
    • M Offline
      max64
      last edited by

      As was documented in this 8 month old thread, users having issues with the screen remaining blank after a MONITORON event solved the problem by replacing the exec statement to tvservice to instead exec vcgencmd in node_helper.js.

      The below solution was posted -
      Change:

      activateMonitor: function () {
          if (this.config.turnOffDisplay) {
            // Check if hdmi output is already on
            exec("/opt/vc/bin/tvservice -s").stdout.on("data", function(data) {
              if (data.indexOf("0x120002") !== -1)
                exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
            });
          }
        },
      
        deactivateMonitor: function () {
          if (this.config.turnOffDisplay) {
            exec("/opt/vc/bin/tvservice -o", null);
          }
        },
      

      WIth:

       activateMonitor: function () {
         if (this.config.turnOffDisplay) {
           // Check if hdmi output is already on
           exec("vcgencmd display_power 1").stdout.on("data", function(data) {
             if (data.indexOf("0x120002") !== -1)
               exec("/opt/vc/bin/tvservice --preferred && chvt 6 && chvt 7", null);
           });
         }
       },
      
       deactivateMonitor: function () {
         if (this.config.turnOffDisplay) {
           exec("vcgencmd display_power 0", null);
         }
       },
      

      However, the node_helper.js language has now changed since the above post to now be:

      		if (query.action === "MONITORON")
      		{
      			exec("tvservice --preferred && sudo chvt 6 && sudo chvt 7", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
      			return true;
      		}
      		if (query.action === "MONITOROFF")
      		{
      			exec("tvservice -o", opts, function(error, stdout, stderr){ self.checkForExecError(error, stdout, stderr, res); });
      			return true;
      		}
      

      I’ve little experience with js coding, and wondered if anyone had already updated the above vcgencmd calls to work with the now current node_helper language? Or if someone could suggest what that language would now be so I don’t break anything ignorantly futzing around?

      (Of course, the optimum would be to have a config option officially added to Remote-Control to have the option of using tvservice (as the default), or vcgencmd for those of us that tvservice doesn’t work so well for…)

      Many thanks for any help provided.

      (Using RPI Zero W / Raspbian Stretch Lite / Dell monitor via HDMI / serveronly mode)

      1 Reply Last reply Reply Quote 0
      • M Offline
        max64
        last edited by

        I should have searched around. This was recently solved with a fork by BKeyport to Remote-Control here.

        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
          OSZAR »