Read the statement by Michael Teeuw here.
MMM-NewPIR v3
-
MMM-NewPIR (v3)
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.
What’s new on V3 ?
- Rewrite entire main code
- New configuration
- Use my own shared npm library
- Add new display style
- More tools: incomming notification for developers
Screenshot


Developer Notes
- This module broadcasts:
USER_PRESENCEnotification with the payload beeingtrueorfalseyou can use it to pause or disable another module.
- This module receive:
USER_PRESENCEnotification with the payloadtrueto force user presence orfalseto force delay to time out.SCREEN_ENDnotification to force the end of the count downSCREEN_WAKEUPnotification to wake up the screen and reset count downSCREEN_LOCKnotification keep the screen on and lock it (freeze counter and stop pir detection)SCREEN_UNLOCKnotification unlock the screen and restart counter and pir detection
-
Hello, unfortunately I need some help.
I have installed the module but as soon as I edit the config magicmirror does not start anymore. -
what’s your config ?
-
/* Magic Mirror Config Sample * * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. * * For more information on how you can configure this file * See https://github.com/MichMich/MagicMirror#configuration * */ var config = { address: "localhost", // Address to listen on, can be: // - "localhost", "127.0.0.1", "::1" to listen on loopback interface // - another specific IPv4/6 to listen on a specific interface // - "0.0.0.0", "::" to listen on any interface // Default, when address config is left out or empty, is "localhost" port: 8080, basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy // you must set the sub path here. basePath must end with a / ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses // or add a specific IPv4 of 192.168.1.5 : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"], // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format : // ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"], useHttps: false, // Support HTTPS or not, default "false" will use HTTP httpsPrivateKey: "", // HTTPS private key path, only require when useHttps is true httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true language: "de", logLevel: ["INFO", "LOG", "WARN", "ERROR"], timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device modules: [ { module: 'MMM-Carousel', config: { transitionInterval: 10000, ignoreModules: ['clock', 'alert', 'calendar', 'MMM-Fuel', 'MMM-Sonos', 'MMM-OpenmapWeather', 'weatherforecast', 'MMM-DWD-Pollen', 'MMM-DWD-WarnWeather', 'newsfeed'], mode: 'positional', top_left: {enabled: true, ignoreModules: ['clock', 'MMM-Fuel', 'calendar']}, top_right: {enabled: false, ignoreModules: ['MMM-OpenmapWeather', 'MMM-DWD-WarnWeather', 'weatherforecast', ], overrideTransitionInterval: 20000} } }, { module: "alert", }, { module: "updatenotification", position: "top_bar" }, { module: "clock", position: "top_left", config: { showSunTimes: "true", lat: "52.4262603", lon: "9.4697593", // See 'Configuration options' for more information. } }, { module: 'MMM-NewPIR', position: 'top_left', config: { debug: false, screen: { delay: 2 * 60 * 1000, turnOffDisplay: true, ecoMode: true, displayCounter: true, text: "Auto Turn Off Screen:", displayBar: true, displayStyle: "Text", governorSleeping: false, rpi4: false }, pir: { usePir: true, gpio: 21, reverseValue: false }, governor: { useGovernor: false, sleeping: "powersave", working: "ondemand" } } }, { module: "calendar", header: "Termine", position: "top_left", config: { maximumEntries: "12", calendars: [ { symbol: "calendar-check", url: "https://calendar.google.com/calendar/ical/pubtgv6fpslkvd2s4tmd8b4164%40group.calendar.google.com/private-6290764b7af7d5aa6ea139fb4826c33c/basic.ics" } ] } }, { module: "MMM-Fuel", position: "top_left", config: { api_key: "654340ee-5805-e1c4-279f-13e7afbc6683", lat: 52.4262603, lng: 9.4697593, radius: 5, max: 5, types: ["e5"], sortBy: "e5", rotate: "false", // all your config options, which are different than their default values } }, { module: "compliments", position: "top_center", config: { compliments: { morning: [ "Guten Morgen Sonnenschein!", "Hab einen schönen Tag!", "Hast du gut geschlafen?" ], afternoon: [ "Wie war dein Tag?", "Du siehst gut aus heute!", "Schön, dass du wieder da bist!" ], evening: [ "Einen schönen Abend!", "Schlaf gut!", ], day_sunny: [ "Heute ist ein Sonniger Tag", "Es ist ein schöner Tag!" ], snow: [ "Schnee!!!", "Schneeballschlacht!", "Lass uns einen Schneemann bauen!" ], cloudy: [ "Es ist wolkig, hoffentlich regnet es nicht" ], showers: [ "Es schüttet draußen, bleibt lieber Zuhause!" ], cloudy_windy: [ "Windig draußen!", "Halt bloß deine Hose fest" ], thunderstorm: [ "GEWITTER??? WOOOOO? ÜBERALL?!", "Es gewittert draußen!" ], fog: [ "Nebel des Todes of Doom!", "Ganz schön nebelig draußen..." ], rain: [ "Nicht den Regenschirm vergessen!", "Ihh es regnet :(" ] } } }, { module: 'MMM-Sonos', header: 'Now playing', position: 'bottom_center', config: { animationSpeed: "1000", showFullGroupName: "true", showArtist: "true", showAlbum: "true", showMetadata: "true" } }, { module: 'MMM-COVID19-SPARKLINE', header: "COVID-19 Fälle", position: "bottom_center", config : { worldStats: true, sparklines: true, sparklineWidth: 100, sparklineHeight: 55, sparklineDays: 50, sparklineDeltavsDaily: false, sortby: "confirmed", columns: ["confirmed", "deaths", "recovered"], countries: ["Germany", "Spain", "Italy", "US"], updateInterval: 1000 * 60 * 60 * 3, //3 hours infoRowClass: "small", headerRowClass: "small", fadeSpeed: 1000, showDelta: true, showDeltaPlotNDays: 14, showDelimiter: true } }, { module: "MMM-OpenmapWeather", header: "Wetter für", position: "top_right", config: { units: "metric", degreeLabel: "true", showFeelsLike: "false", showHumidity: "true", useKMPHwind: "true", useBeaufort: "false", colorIcon: "true", lang: "de", location: "Wunstorf", locationID: "2805761", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city appid: "60328ec38ba3b4f61059f193dff92f13" } }, { module: 'MMM-DWD-WarnWeather', position: 'top_right', // header: 'Wetterwarnungen', config: { warnCellID: "803241021", changeColor: true, minutes: false, displayRegionName: true, displayInnerHeader: true, interval: 10 * 60 * 1000, // every 10 minutes loadingText: 'Warnungen werden geladen...', noWarningText: 'Keine Warnungen', severityThreshold: 1 } }, { module: "weatherforecast", position: "top_right", header: "Wettervorhersage für", config: { units: "metric", showRainAmount: "true", lang: "de", scale: "true", colored: "true", location: "Wunstorf", locationID: "2805761", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city appid: "60328ec38ba3b4f61059f193dff92f13", maxNumberOfDays: "7" } }, { module: "MMM-DWD-Pollen", position: "top_right", header: "Pollenwarnung", config: { updateInterval: 1 * 60 * 60 * 1000, // every 1 hour1 DWD_region: 32, // Östliches Niedersachsen icon: false // Show icons or not } }, { module: "MMM-RAIN-MAP", position: "top_right", header: "Regenradar", config: { animationSpeed: 600, displayClockSymbol: true, displayTime: true, extraDelayLastFrame: 500, height: "300px", lat: 52.42580, lng: 9.42944, map: "OSM", markers: [ { lat: 52.42755, lng: 9.47309, color: "blue" } ], onlyOnRain: false, opacity: 0.65, timeFormat: 24, updateIntervalInSeconds: 300, width: "300px", zoom: 8, zoomOutEach: 3, zoomOutLevel: 3, } }, { module: "newsfeed", position: "bottom_bar", config: { feeds: [ { title: "Tagesschau", url: "http://www.tagesschau.de/xml/rss2" }, { title: "Heise", url: "https://www.heise.de/rss/heise-atom.xml" }, ], showSourceTitle: true, showPublishDate: true, broadcastNewsFeeds: true, broadcastNewsUpdates: true } }, { module: "MMM-SpaceX", position: "top_left", config: { records: 3, modus: "upcoming", showExtraInfo: false, showColumnHeader: true, } }, { module: 'MMM-WiFiPassword', position: "top_left", config: { //See 'Configuration options' for more information. network: "FRITZ!Box 7590 M&K", password: "***", showPassword: true, } }, ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") {module.exports = config;} -
configuration seems good
do you have any error on start ?
If you use pm2 -> stop the process and start it manually with
npm startcommandgive me log or error ?
-
-
some library missing … do you use npm install command for installing ?
-
Yes I have stopped MagicMirror and installed the module.
pi@PiSmartMirror:~/MagicMirror/modules/MMM-NewPIR $ npm install > MMM-NewPIR@3.0.1 install /home/pi/MagicMirror/modules/MMM-NewPIR > scripts/installer.sh npm notice created a lockfile as package-lock.json. You should commit this file. audited 176 packages in 5.506s 4 packages are looking for funding run `npm fund` for details found 0 vulnerabilities -
can you try this:
bugs@debian:~/MagicMirror/modules/MMM-NewPIR$ rm -rf node_modules/ bugs@debian:~/MagicMirror/modules/MMM-NewPIR$ rm package-lock.json bugs@debian:~/MagicMirror/modules/MMM-NewPIR$ npm install npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported epoll@4.0.0 install /home/bugs/MagicMirror/modules/MMM-NewPIR/node_modules/epoll node-gyp rebuild make : on entre dans le répertoire « /home/bugs/MagicMirror/modules/MMM-NewPIR/node_modules/epoll/build » CXX(target) Release/obj.target/epoll/src/epoll.o SOLINK_MODULE(target) Release/obj.target/epoll.node COPY Release/epoll.node make : on quitte le répertoire « /home/bugs/MagicMirror/modules/MMM-NewPIR/node_modules/epoll/build » @bugsounet/pir@1.0.4 postinstall /home/bugs/MagicMirror/modules/MMM-NewPIR/node_modules/@bugsounet/pir > electron-rebuild ✔ Rebuild Complete MMM-NewPIR@3.0.1 install /home/bugs/MagicMirror/modules/MMM-NewPIR scripts/installer.sh npm notice created a lockfile as package-lock.json. You should commit this file. added 176 packages from 127 contributors and audited 176 packages in 26.073s 4 packages are looking for funding run `npm fund` for details found 0 vulnerabilities bugs@debian:~/MagicMirror/modules/MMM-NewPIR$ cd ~/MagicMirror bugs@debian:~/MagicMirror$ npm start -
That’s it. Seems to work now… Thank You :)
-
perfect so :)
when it want to works, it's magical -
Hi @Bugsounet just going to install your module with deep hope in it’s functionality.
I’m going to use it on an Pi0 and get (now two times) an Network error:Software caused connection aborton Putty whilenpm installHere all I get in console:
pi@RasPiZeroW:~/MagicMirror/modules/MMM-NewPIR $ npm install npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported > epoll@4.0.0 install /home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/epoll > node-gyp rebuild make: Verzeichnis „/home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/epoll/build“ wird betreten CXX(target) Release/obj.target/epoll/src/epoll.oAny idea, or is it caused on the hardware of RPi0?
I tried to start again and deleted all MMM-NewPIR stuff and rebootet RPi.
New attemptgit cloneandnpm installGetting this in coonsole:
pi@RasPiZeroW:~/MagicMirror/modules/MMM-NewPIR $ npm install npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated har-validator@5.1.5: this library is no longer supported > epoll@4.0.0 install /home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/epoll > node-gyp rebuild make: Verzeichnis „/home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/epoll/build“ wird betreten CXX(target) Release/obj.target/epoll/src/epoll.o SOLINK_MODULE(target) Release/obj.target/epoll.node COPY Release/epoll.node make: Verzeichnis „/home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/epoll/build“ wird verlassen > @bugsounet/pir@1.0.4 postinstall /home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/@bugsounet/pir > electron-rebuild ⠸ Building module: epoll, Completed: 0and status
⠸ Building module: epoll, Completed: 0is not changing colpetition even it run and run.So I assume it’s really related to RPi0 installation and electron. But that is to deep for my small knowledge selfsolving if possible anyway.
-
Thanks for this new PIR module! I replaced last night the MMM-PIR-sensor module with yours and it works perfectly, also with my microwave sensor.
Especially the behaviour after the first start is now as expected, as the display is switches off after the countdown, without initializing the sensor first. With MMM-PIR-sensor the display would have stayed on after the first start until the sensor catches once a motion and the start the coutdown. I tweaked the node_helper.js to correct that, but after each module update I had to reapply that tweek. That belongs now to the past. Great job!:clapping_hands_light_skin_tone:I have a feature request:
I would like to have two configuration options available to adjust the colours of “displayStyle”, as currently it is hardcoded in green:- One option to adjust the colour of the remaining time (wich is currently green).
- Another option to adjust the colour of the past time (currently dark grey or white).
something like this:
displayStyleRemaining: 'e2e2e2', //RGB value of the remaining time displayStylePast: '454545', //RGB value of the past time [...]I’m using the “Bar” style on “bottom_bar” position, which shows a decent thin line over the hole width of the mirror, which slowly creeps down to the left. But it is hard to distinguish the remaining time (green) and the past time (white) of that bar. I would prefer to adjust the remaining time to white, and the past time to black, as an example.
What do you think?
Oh BTW: I might help other users, if you enhance a little bit the README on GitHub on how to make the display styles visible. It took me some trials until I found out to configure an empty string for the “text” option to make the other styles show up.
-
@bdream :
> @bugsounet/pir@1.0.4 postinstall /home/pi/MagicMirror/modules/MMM-NewPIR/node_modules/@bugsounet/pir > electron-rebuild ⠸ Building module: epoll, Completed: 0it’s a very very long processing for a pi0 but needed …
I never try with it, i don’t know how time it can take (and if it’s works !)@Fozi : thanks for you feedback !
NP v3 is result of a lot of works ;)
First it’s part of code from another module (Assistant2Display).
NP v3 is make for user who don’t want (don’t use or don’t know) to use GoogleAssistant/Assistant2Display
I port it to NP v3 with my own npm library (less code and sync all code for all my modules)
I have to code the new feature from Assistant2Display (Last Presence display) to NV v3If you want you can do a Pull request do add your wanted feature ;)
if you want to do it, you can make it in dev branch (for temp code and developping) and not in master (only for releasing)
So Pull request is welcome :) -
Well, that means I‘ll have get much much deeper into coding and learn js. But hey, why not? Cold and dark autumn is coming and that’ll be a nice project 🤗
-
the hardest part is to anticipate the slightest possible error so as not to crash everything (and even crash MM)
If you can’t do it, i will do it soon :)
I finish other new module before ;)so planned to this module:
- Last presence
- color feature
- HDMI CEC support
-
@Bugsounet
don’t know how time it can take (and if it’s works !)
After a couple of trys it run to end but in time including MMM-NewPIR into config (smallest example or within many configurations…) mirror give error as config not available.I hang it up an the RPi0
Will try it soon on an RPi3B as I feel this is a great module. - thanks for providing!
-
memory less in pi0, so it’s difficult to do complex think with it
-
Hi Cedric,
I’ve received an update notification for this module, but something must have happened on Github:
pi@MagicMirror:~/MagicMirror/modules/MMM-NewPIR $ git pull Username for 'https://github.com': XXX.YYY@gmail.com Password for 'https://helmut.weigel@gmail.com@github.com': remote: Repository not found. fatal: repository 'https://github.com/bugsounet/MMM-NewPIR.git/' not foundPlease advise.
.
.
.

-
currently all modules developed by bougsounet are offline due to some issue with MM project founder.
If you want them to go back online please invite the MM project owner, michmich, to have a dialogue.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
