Skip to content
MagicMirror Action with PIR Sensor
JavaScript Shell CSS
Branch: master
Clone or download


Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts update installer Jan 31, 2020
LICENSE Initial commit Aug 31, 2019
MMM-NewPIR.css Debug mode Dec 11, 2019
MMM-NewPIR.js Add reverseValue Feature Feb 19, 2020 Update Feb 19, 2020
node_helper.js not needed Feb 19, 2020
package.json Update package.json Feb 19, 2020


MMM-NewPIR 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 and hide all module for economy mode.

If you don't have PIR sensor, it can also be used for automatic turn on / turn off screen.

MMM-AssistantAMk2 v3 Ready


Clone the module into your MagicMirror module folder and execute npm intall in the module's directory.

git clone
npm install

Note for RPI4 user

RPI4 firmware not support actually vcgencmd display_power command.

So, turn off display should not working


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

  module: 'MMM-NewPIR',
  position: 'top_left',
  config: {
    useSensor: true,
    sensorPin: 21,
    reverseValue: false,
    delay: 2* 60 * 1000,
    turnOffDisplay: true,
    ecoMode: true,
    governor: "",
    debug: false

Option Description Type Default
useSensor Use sensor or not Boolean true
sensorPin BCM-number of the sensor pin Integer 21
reverseValue Set it to false if sensor detect presence on value 1. Set it to true if sensor detect presence on value 0 Bloolean  false
delay Time before the mirror turns off the display if no user activity is detected. (in ms) Integer 60000 (1 minutes)
turnOffDisplay Should the display turn off after timeout? Boolean true
ecoMode Should the MagicMirror hide all module after timeout ? Boolean true
governor Set CPU Governor on start. Available : conservative ondemand userspace powersave performance or set "" for no change String ""

Developer Notes

  • This module broadcasts a USER_PRESENCE notification with the payload beeing true or false you can use it to pause or disable your module.
  • This module receive USER_PRESENCE notification with the payload true to force user presence or false to force delay to time out.

Change Log


  • add reverseValue Feature :
    • Set it to false if sensor detect presence on value 1.
    • Set it to true if sensor detect presence on value 0


  • Correct possibility fix Gpio issue ?


  • correct USER_PRESENCE { false } notification receive


  • add useSensor feature


  • V2 initial commit
  • Rewrite code
You can’t perform that action at this time.