Skip to content
This MagicMirror module monitors a PIR sensor and turns on/off your display. You can even run custom scripts and control it via Telegram.
JavaScript Shell Other
Branch: master
Clone or download
Latest commit 5bd1445 Oct 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
callbackScripts Add sample callback scripts Mar 11, 2018
translations Added sv.json Oct 11, 2018
MMM-PIR.js Set last activity after countdown expired. This fixes issue #2 Mar 14, 2018
mmm-pir-style.css Rename css Mar 11, 2018
node_helper.js Support interval interruption Mar 11, 2018
package.json Implement countdown Mar 11, 2018
screenshot.png Add screenshot Mar 11, 2018


MMM-PIR is a module for the MagicMirror project by Michael Teeuw.

It uses a PIR sensor attached to your raspberry pi's GPIO pins to check for users. After a configurated time without any user interaction the display will turn off. You can specify additional scripts (sh, python and js are supported) that will run after the timeout.



Cline the module into your MagicMirror module folder and execute npm install in the module's directory-.

git clone
npm install


To display the module insert it in the config.js file. Here is an example:

    module: 'MMM-PIR',
    position: 'bottom_center',
    config: {
        sensorPin: 4,
        delay: 10000,
        turnOffDisplay: true,
        showCountdown: true,
        callbackScripts: [""]

Option Description Type Default
sensorPin BCM-number of the pin Integer 4
delay time before the mirror turns off the display if no user activity is detected. (in ms) Integer 10000 (10 seconds)
turnOffDisplay Should the display turn off after timeout? Boolean true
showCountdown Should the MagicMirror display the countdown on screen? Boolean true
callbackScripts Scripts that execute after the timeout. Scripts must be placed inside the callbackScripts folder. Supported script types: sh, py, js Array of strings none

Telegram commands

You can control this module via Telegram with the following commands. Note: You need to install MMM-TelegramBot

Command Description
/resetPir Resets the countdown to configured settings.
/resetPirDefaults Reset the countdown to default settings.
/setCustomPirCountdown Configure a custom countdown (in seconds).
You can’t perform that action at this time.