Skip to content
MagicMirror module that allows displaying and hiding modules when a hardware button is pushed.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig ADDED: Initial module skeleton. Aug 3, 2018
.eslintrc.json CLEANED UP: Linter violations are fixed. Aug 7, 2018
.gitignore Initial commit Aug 3, 2018
.stylelintrc ADDED: Initial module skeleton. Aug 3, 2018
Gruntfile.js ADDED: Initial module skeleton. Aug 3, 2018
LICENSE Initial commit Aug 3, 2018
MMM-ModuleToggleButton.js CLEANED UP: Linter violations are fixed. Aug 7, 2018
node_helper.js CLEANED UP: Linter violations are fixed. Aug 7, 2018
package.json ADDED: postinstall script for electron-rebuild. Aug 3, 2018


This is a module for the MagicMirror² to show and hide modules when a hardware button is pushed. This can be useful to temporarily display modules for debugging after the mirror is deployed.


With this module you can control the visibility of a set of modules by pressing a temporary push button connected to a GPIO port of your Raspberry Pi. This module will hide the target modules when the MagicMirror is started, and show them when you press and release the push button. To hide the target modules press and release the push button again.

This module can be useful to temporary display modules that you need only for maintenance (e.g. MMM-SystemStats, MMM-Remote-Control, MMM-NetworkConnection or MMM-ip).

This module does not render anything to the screen of the MagicMirror, just controls other modules.

For updates, please check the CHANGELOG.

Using the module

To use this module follow these steps:

  1. Clone this repository to the modules folder of your MagicMirror:
git clone
  1. Run npm install in the modules/MMM-ModuleToggleButton folder to install its dependencies.

  2. Add the following configuration block to the modules array in the config/config.js file to control the visibility of the built-in Clock and Calendar modules:

var config = {
  modules: [
      module: 'MMM-ModuleToggleButton',
      config: {
        buttonGpioPin: 6,
        moduleNames: [
  1. Connect a momentary push button between the GPIO 6 and GND (Ground) pins of the Raspberry Pi.

Configuration options

Option Description
buttonGpioPin REQUIRED The number of the GPIO pin to what the button is connected.

Type: number
Default value: 6
moduleNames REQUIRED The list of module names that are controlled by this module.

Type: Array<string>
Default value: [] (empty string array - does nothing)
debounceTimeoutInMilliseconds Optional The delay in milliseconds before the button push is detected while the GPIO input is bouncing.

Type: number
Default value: 500

How it works

This module uses the onoff NPM package to monitor the GPIO input, and uses the MM.getModules().withClass(...) API of the MagicMirror to find the target modules by their name.


If you would like to contribute to the codebase, please use the preconfigured linters to analyze the source code before sending a pull request. To run the linters follow these steps:

  1. Install developer dependencies:
npm install
  1. Install Grunt:
npm install -g grunt
  1. Use Grunt to run all linters:

Got feedback?

Your feedback is more than welcome, please send your suggestions, feature requests or bug reports as Github issues.

About the author

This project is created and maintaned by György Balássy.

You can’t perform that action at this time.