{"id":16321991,"url":"https://github.com/balassy/mmm-moduletogglebutton","last_synced_at":"2025-08-28T17:36:08.254Z","repository":{"id":147827576,"uuid":"143376723","full_name":"balassy/MMM-ModuleToggleButton","owner":"balassy","description":"MagicMirror module that allows displaying and hiding modules when a hardware button is pushed.","archived":false,"fork":false,"pushed_at":"2024-03-11T03:17:38.000Z","size":48,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-11T04:27:01.946Z","etag":null,"topics":["button","javascript","magicmirror","magicmirror2","module","raspberry-pi","raspberrypi"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/balassy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-08-03T04:15:27.000Z","updated_at":"2024-03-11T03:14:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9f4b994-b4b9-42bd-b3e0-146ef826a33c","html_url":"https://github.com/balassy/MMM-ModuleToggleButton","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balassy%2FMMM-ModuleToggleButton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balassy%2FMMM-ModuleToggleButton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balassy%2FMMM-ModuleToggleButton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balassy%2FMMM-ModuleToggleButton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balassy","download_url":"https://codeload.github.com/balassy/MMM-ModuleToggleButton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219865113,"owners_count":16555931,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["button","javascript","magicmirror","magicmirror2","module","raspberry-pi","raspberrypi"],"created_at":"2024-10-10T22:49:40.728Z","updated_at":"2024-10-10T22:49:41.174Z","avatar_url":"https://github.com/balassy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MMM-ModuleToggleButton\n\nThis is a module for the [MagicMirror²](https://github.com/MichMich/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.\n\n## Features\n\nWith 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.\n\nThis module can be useful to temporary display modules that you need only for maintenance (e.g. [MMM-SystemStats](https://github.com/BenRoe/MMM-SystemStats), [MMM-Remote-Control](https://github.com/Jopyth/MMM-Remote-Control), [MMM-NetworkConnection](https://github.com/slametps/MMM-NetworkConnection) or [MMM-ip](https://github.com/fewieden/MMM-ip)).\n\nThis module does not render anything to the screen of the MagicMirror, just controls other modules.\n\nFor updates, please check the [CHANGELOG](https://github.com/balassy/MMM-ModuleToggleButton/blob/master/CHANGELOG.md).\n\n## Using the module\n\nTo use this module follow these steps:\n\n1. Clone this repository to the `modules` folder of your MagicMirror:\n\n```bash\ngit clone https://github.com/balassy/MMM-ModuleToggleButton.git\n```\n\n2. Run `npm install` in the `modules/MMM-ModuleToggleButton` folder to install its dependencies.\n\n3. 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:\n\n```js\nvar config = {\n  modules: [\n    {\n      module: 'MMM-ModuleToggleButton',\n      config: {\n        buttonGpioPin: 6,\n        moduleNames: [\n          'clock',\n          'calendar'\n        ]\n      }\n    }\n  ]\n}\n```\n\n4. Connect a momentary push button between the GPIO 6 and GND (Ground) pins of the Raspberry Pi.\n\n## Configuration options\n\n| Option                 | Description\n|------------------------|-----------\n| `buttonGpioPin`        | **REQUIRED** The number of the GPIO pin to what the button is connected.\u003cbr\u003e\u003cbr\u003e **Type:** `number` \u003cbr\u003e**Default value:** `6`\n| `moduleNames`          | **REQUIRED** The list of module names that are controlled by this module.\u003cbr\u003e\u003cbr\u003e **Type:** `Array\u003cstring\u003e` \u003cbr\u003e**Default value:** `[]` (empty string array - does nothing)\n| `debounceTimeoutInMilliseconds`| *Optional* The delay in milliseconds before the button push is detected while the GPIO input is bouncing.\u003cbr\u003e\u003cbr\u003e **Type:** `number` \u003cbr\u003e**Default value:** `500`\n\n## How it works\n\nThis module uses the [onoff NPM package](https://www.npmjs.com/package/onoff) to monitor the GPIO input, and uses the `MM.getModules().withClass(...)` API of the MagicMirror to find the target modules by their name.\n\n## Contribution\n\nIf 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:\n\n1. Install developer dependencies:\n\n```bash\nnpm ci\n```\n\n2. Run all linters:\n\n```bash\nnpm run lint\n```\n\n## Got feedback?\n\nYour feedback is more than welcome, please send your suggestions, feature requests or bug reports as [GitHub issues](https://github.com/balassy/MMM-ModuleToggleButton/issues).\n\n## About the author\n\nThis project is created and maintaned by [György Balássy](https://www.linkedin.com/in/balassy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalassy%2Fmmm-moduletogglebutton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalassy%2Fmmm-moduletogglebutton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalassy%2Fmmm-moduletogglebutton/lists"}