MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Turn monitor on/off with MMM-voice

  • Re: Want to turn off my monitor

    Hey guys! I’ve been reading some old threads and trying to make my monitor turn off and on with a voice command via MMM-voice.

    I’m NOT using a Pi, but a laptop. I’ve tried @Mykle1’s following commands: (from Hello-Lucy - which works)

    exec('xset dpms force off', null);
    exec('xset dpms force on', null);

    I’ve implemented the code in the node_helper.js that executes a command when a voice command is detected:

    } else if (/(CUSTOM)/g.test(data)) {
    	    exec('xset dpms force off', null);

    The above code is executed when my mirror register the word “custom”.

    this.sendSocketNotification(‘CUSTOM’); is there just so I can see if the command is recognized.

    Problem: As it is right now, I can see that my mirror registers and executes the this.sendSocketNotification(‘CUSTOM’); however the exec(‘xset dpms force off’, null); does nothing. Any ideas?

    Thanks in advance!

  • Module Developer

    Your laptop works with xset dpms force off on a shell? See your energy-saving setting in your environment.

  • @sean said in Turn monitor on/off with MMM-voice:

    Your laptop works with xset dpms force off on a shell? See your energy-saving setting in your environment.

    Hey Sean! I’m on Ubuntu 18.10, so I guess it should work. I’m pretty sure Mykle1 is on Ubuntu 16.04.

    As far as I know there is no energy-saving settings really. Could you elaborate you answer maybe? 😃

  • Module Developer

    I’m not experienced with Ubuntu, but I think there might be DPMS manager (Screen saver, monitor on/off) on X. You’d better check using DPMS enabled.

  • @sean So you’re saying there might be a setting that allows for the DPMS being turned on and off, right?

  • Module Developer

    What would be displayed as the result of xset -q ?

  • @sean Hey again Sean,

    So here’s the output of xset -q:

    I noticed the following: Server does not have the DPMS Extension 😑 Figured that’s why it’s not working. So I’m not sure about this whole DPMS thing. Is it an extension I can install or is it something native to a computer, e.g. hardware?

    Keyboard Control:
      auto repeat:  on    key click percent:  0    LED mask:  00000000
      XKB indicators:
        00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
        03: Compose:     off    04: Kana:        off    05: Sleep:       off
        06: Suspend:     off    07: Mute:        off    08: Misc:        off
        09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
        12: Group 2:     off    13: Mouse Keys:  off
      auto repeat delay:  500    repeat rate:  33
      auto repeating keys:  00ffffffdffffbbf
      bell percent:  50    bell pitch:  400    bell duration:  100
    Pointer Control:
      acceleration:  2/1    threshold:  4
    Screen Saver:
      prefer blanking:  yes    allow exposures:  yes
      timeout:  0    cycle:  0
      default colormap:  0x23    BlackPixel:  0x0    WhitePixel:  0xffffff
    Font Path:
    DPMS (Energy Star):
      Server does not have the DPMS Extension

  • Module Developer

    @mdhenriksen said in Turn monitor on/off with MMM-voice:

    DPMS (Energy Star):
    Server does not have the DPMS Extension

    I’m not expert of this kind, so I might be wrong.

    As I know, in nowadays modern linux machine, DPMS is auto detected and enabled if ACPI is also enabled at kernel runtime. However check /etc/X11/xorg.conf.d/ in the Monitor section (Or corresponding alternatives on your environment. Again, I’m not familiar with *nix machines 😃 )

    Option "DPMS" "true"

  • @sean Yeah, I’m trying to look into that right now, but without much luck at the moment 😃


    This is not really a solution, but my error was that I was logged in on “Ubuntu on Wayland” which doesn’t have DPMS.

    On the login screen of Ubuntu you can click the little gear-icon and choose what kind of Ubuntu you want to login to. Wayland is a bit restricted, so just go with “Ubuntu” and not “Ubuntu on Wayland”

Log in to reply