This module manage monitor with PIR motion sensor (automatic standby when presence isn't detected).
Title, countdown and detection icon display may be enabled or disabled.
xrandr
(default option). The use of vcgencmd
(previous option) is always possible with an additional option. More information below...
In your terminal, go to your MagicMirror's Module folder:
cd ~/MagicMirror/modules
Clone this repository:
git clone https://github.com/grenagit/MMM-PIR-Sensor-Lite
Go to your MMM-PIR-Sensor-Lite's Module folder:
cd ~/MagicMirror/modules/MMM-PIR-Sensor-Lite
Install dependencies:
npm install
Configure the module in your config.js file.
In your terminal, go to your MMM-PIR-Sensor-Lite's Module folder:
cd ~/MagicMirror/modules/MMM-PIR-Sensor-Lite
Incorporate changes from this repository:
git pull
Install dependencies:
npm install
To use this module, add it to the modules array in the config/config.js
file:
modules: [
{
module: "MMM-PIR-Sensor-Lite",
position: "top_right",
config: {
sensorPin: 2, // GPIO pin
}
}
]
The following properties can be configured:
Option | Description |
---|---|
sensorPin |
The GPIO pin of the sensor. This value is REQUIRED |
commandType |
The command used to manage monitor. Possible values: 'vcgencmd' , 'xrandr' or 'xset' Default value: 'xrandr' |
hdmiPort |
The HDMI port (required for xrandr ) Possible values: HDMI-1 or HDMI-2 Default value: HDMI-1 |
title |
The title. It's hidden if title: "" Default value: "Automatic Standby" |
rotation |
Direction of content rotation. Possible values: 'normal' , 'left' , 'right' or 'inverted' Default value: 'normal' |
deactivateDelay |
How often does the content needs to be fetched? (Milliseconds) Possible values: 1000 - 86400000 Default value: 15 * 60 * 1000 (15 minutes) |
updateInterval |
How often does the countdown needs to be updated? (Milliseconds) Possible values: 0 - 5000 Default value: 1000 (1 second) |
animationSpeed |
Speed of the update animation. (Milliseconds) Possible values: 0 - 5000 Default value: 1000 (1 second) |
showCountDown |
Show the countdown. Possible values: true or false Default value: true |
showDetection |
Show an icon at each presence detection. Possible values: true or false Default value: true |
hoursLabel |
Hours label Default value: 'h' |
minutesLabel |
Minutes label Default value: 'm' |
secondsLabel |
Seconds label Default value: 's' |
debugMode |
Activate debug mode (command is disabled) Possible values: true or false Default value: false |
Debian 11 Bullseye:
Due to a problem between vcgencmd
on Raspberry Pi OS Bullseye, please use:
xrandr
(default option).xset
withcommandType: 'xset',
in your MMM-PIR-Sensor-Lite's config.
Debian 10 Buster:
You can continue to use vcgencmd
with commandType: 'vcgencmd',
in your MMM-PIR-Sensor-Lite's config.
In your terminal, run the python script after replacing SENSOR_PIN
by the GPIO pin of the sensor:
python3 -u ~/MagicMirror/modules/MMM-PIR-Sensor-Lite/pir.py SENSOR_PIN
PIR_START
is displayed in your terminal when the PIR sensor start is confirmed!
USER_PRESENCE
is displayed in your terminal when a presence is detected by the sensor!
In your terminal, go to your MagicMirror's folder:
cd ~/MagicMirror
Run MagicMirror in developper mode (with console):
npm run start:dev
You can follow the information logged by MMM-PIR-Sensor-Lite starting with MMM-PIR-Sensor-Lite
like this:
This module is licensed under the MIT Licens