MagicMirror² v2.12.0 is available! For more information about this release, check out this topic.

MMM-NewPIR v3


  • Module Developer

    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_PRESENCE notification with the payload beeing true or false you can use it to pause or disable another module.
    • This module receive:
      • USER_PRESENCE notification with the payload true to force user presence or false to force delay to time out.
      • SCREEN_END notification to force the end of the count down
      • SCREEN_WAKEUP notification to wake up the screen and reset count down
      • SCREEN_LOCK notification keep the screen on and lock it (freeze counter and stop pir detection)
      • SCREEN_UNLOCK notification 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.


  • Module Developer

    what’s your config ?



  • @Bugsounet

    /* 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;}
    

  • Module Developer

    configuration seems good

    do you have any error on start ?

    If you use pm2 -> stop the process and start it manually with npm start command

    give me log or error ?




  • Module Developer

    some library missing … do you use npm install command for installing ?



  • @Bugsounet

    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
    

  • Module Developer

    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
    


  • @Bugsounet

    That’s it. Seems to work now… Thank You 🙂


Log in to reply