mboskamp / mmm-pir Goto Github PK
View Code? Open in Web Editor NEWThis MagicMirror module monitors a PIR sensor and turns on/off your display. You can even run custom scripts and control it via Telegram.
This MagicMirror module monitors a PIR sensor and turns on/off your display. You can even run custom scripts and control it via Telegram.
Good afternoon (or morning or evening!),
I'm running into an issue that seems to be consistent throughout either of the two PIR modules I use. The module works great for a short period of time: Walk up, sensor detects movement, wakes screen up, do my mirror things, walk away from the mirror, eventually doesn't detect new motion, goes to sleep once timer expires. I can do this consistently on time frames of less than 5-10 minutes. If I let the system run longer than that though, if I try to go wake the mirror up, I get nothing. Nothing responds, no camera, no voice, no motion, nothing. Only thing I can do is hard reset by pulling the plug and powering it off/on again.
I've seen this issue crop up a couple other times from some users but none of the fixes I've tried have had any effect. This is the LAST bug I'm trying to squash so that my mirror is fully operable and I won't have to constantly reset it every morning or something. Any assistance would be appreciated. As additional, I've tried installing xscreensaver, I've modified several different directories as per other's suggestions, all to no avail. Please let me know what I can do to add to help diagnose what the issue is and so we can rectify it (for me and possibly others!).
Raspberry Pi 3 b+
Raspbian Buster
If you need anything specific from my config file, please let me know.
The Screen is black and i only see my mouse...
I got following error:
^[[31mWARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: ReferenceError: NodeHelper is not defined^[[39m
^[[31m at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:11:18)^[[39m
^[[31m at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:67:3)^[[39m
^[[31m at Module._compile (internal/modules/cjs/loader.js:711:30)^[[39m
^[[31m at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)^[[39m
^[[31m at Module.load (internal/modules/cjs/loader.js:620:32)^[[39m
^[[31m at tryModuleLoad (internal/modules/cjs/loader.js:559:12)^[[39m
^[[31m at Function.Module._load (internal/modules/cjs/loader.js:551:3)^[[39m
^[[31m at Module.require (internal/modules/cjs/loader.js:658:17)^[[39m
^[[31m at require (internal/modules/cjs/helpers.js:20:18)^[[39m
^[[31m at loadModule (/home/pi/MagicMirror/js/app.js:126:17)^[[39m
App threw an error during load
ReferenceError: NodeHelper is not defined
at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:11:18)
at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:67:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at loadModule (/home/pi/MagicMirror/js/app.js:126:17)
ReferenceError: NodeHelper is not defined
at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:11:18)
at Object. (/home/pi/MagicMirror/modules/MMM-PIR/node_helper.js:67:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at loadModule (/home/pi/MagicMirror/js/app.js:126:17)
Thank you for this awesome module. I would like to know if its possible to run custom scripts when user is active ? I want to play random music when user is detected and stop it when he's inactive.
module epoll that is installed via onoff creates problems!
2019-12-17T21:22:41 <error> WARNING! Could not load config file. Starting with default configuration. Error found: Error: The module '/home/pi/MagicMirror/modules/MMM-PIR/node_modules/onoff/node_modules/epoll/build/Release/epoll.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 67. This version of Node.js requires
NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). (/home/pi/MagicMirror/js/app.js:74 loadConfig)
2
node v 11.4.0
npm v 6.13.0
MM v 2.8.0
Hi,
I need some help here please :-)
I’m on latest master and everything works fine. BUT when I activate MMM-PIR, one of my MMM-ModuleScheduler schedules stops working. When I comment out MMM-PIR from the config everything works as expected.
Could someone maybe point me in a direction of where to dig in deeper to find out whats going wrong?
Thanks!!
Cheers
Flo
Here is my config:
/* Magic Mirror Config Sample
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*
* For more information how you can configurate this file
* See https://github.com/MichMich/MagicMirror#configuration
*
*/
var config = {
address: "", // 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, is "localhost"
port: 8080,
ipWhitelist: [], // Set [] to allow all IP addresses
//["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:10.10.10.51"], // 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"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
fullscreen: true,
},
modules: [
{
module: "alert"
},
{
module: 'MMM-Remote-Control'
},
{
module: 'MMM-ModuleScheduler',
config: {
notification_schedule: [
// RESTART THE MAGICMIRROR PROCESS AT 2am EVERY day
{notification: 'REMOTE_ACTION', schedule: '0 2 * * *', payload: {action: "RESTART"}},
],
// SHOW MODULES WITH THE CLASS 'go2work_scheduler' AT 06:00 AND HIDE AT 10:00 EVERY DAY
global_schedule: {from: '0 6 * * *', to: '0 10 * * *', groupClass: 'go2work_scheduler' }
},
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: "clock",
position: "top_left"
},
{
module: 'worldclock',
position: 'top_left', // This can be any of the regions, best results in top_left or top_right regions
config: {
timeFormat: 'HH:mm', //defined in moment.js format()
style: 'top', //predefined 4 styles; 'top', 'left','right','bottom'
clocks: [
{
title: "Bali", // Too long title could cause ugly text align.
timezone: "Asia/Makassar", //When omitted, Localtime will be displayed. It might be not your purporse, I bet.
flag: "id",
},
]
}
},
{
module: "calendar",
header: "Termine",
position: "top_left",
config: {
displaySymbol: false,
calendars: [
{
url: '',
auth: {
user: '',
pass: '',
method: 'basic'
}
},
{
url: '',
auth: {
user: '',
pass: ''
method: 'basic'
}
},
],
}
},
{
module: "calendar",
header: "",
position: "top_left",
config: {
maximumEntries: "3",
displaySymbol: false,
calendars: [
{
url: '',
symbol: 'trash',
auth: {
user: '',
pass: '',
method: 'basic'
}
},
],
}
},
{
module: "currentweather",
position: "top_right",
config: {
location: "",
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
appid: ""
}
},
{
module: "weatherforecast",
position: "top_right",
header: "Weather Forecast",
config: {
location: "",
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
appid: ""
}
},
{
module: "newsfeed",
position: "bottom_bar",
config: {
feeds: [
{
title: "Der Postillion",
url: "http://feeds.feedburner.com/blogspot/rkEL?format=xml"
},
{
title: "Tagesschau",
url: "http://www.tagesschau.de/xml/rss2"
}
],
showSourceTitle: true,
showPublishDate: true
}
},
{
module: 'MMM-PIR',
position: 'bottom_center',
config: {
sensorPin: 22,
delay: 30000,
turnOffDisplay: true,
showCountdown: false
}
},
{
module: 'MMM-DWD-WarnWeather',
position: 'top_right',
config: {
region: '',
changeColor: true,
minutes: false,
displayRegionName: true,
interval: 10 * 60 * 1000, // every 10 minutes
longversion: true,
loadingText: 'Warnungen werden geladen...',
noWarningText: 'Keine Warnungen'
}
},
{
module: 'MMM-DWD-WarnWeather',
position: 'top_right',
classes: 'test_scheduler',
config: {
region: '',
changeColor: true,
minutes: false,
displayRegionName: true,
interval: 10 * 60 * 1000, // every 10 minutes
loadingText: 'Warnungen werden geladen...',
noWarningText: 'Keine Warnungen'
}
},
{
module: 'MMM-GoogleMapsTraffic',
position: 'top_left',
classes: 'scheduler',
config: {
module_schedule: {from: '0 6 * * *', to: '0 10 * * *' },
key: '',
lat: ,
lng: ,
height: '300px',
width: '300px'
}
},
{
module: 'MMM-rfacts',
position: 'bottom_bar'
},
{ module: 'MMM-NiceThings',
position: 'lower_third'
},
{
module: 'DailyXKCD',
position: 'lower_third',
config: {
invertColors: true,
randomComic: true,
titleFont: 'small',
title: true,
altText: false
}
},
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}
'''
Here is the pm2 out log:
Starting MagicMirror: v2.3.1
Loading config ...
Loading module helpers ...
No helper found for module: alert.
Initializing new module helper ...
Module helper loaded: MMM-Remote-Control
Initializing new module helper ...
Module helper loaded: MMM-ModuleScheduler
Initializing new module helper ...
Module helper loaded: updatenotification
No helper found for module: clock.
No helper found for module: worldclock.
Initializing new module helper ...
Module helper loaded: calendar
No helper found for module: currentweather.
No helper found for module: weatherforecast.
Initializing new module helper ...
Module helper loaded: newsfeed
Initializing new module helper ...
Module helper loaded: MMM-PIR
Initializing new module helper ...
Module helper loaded: MMM-DWD-WarnWeather
No helper found for module: MMM-GoogleMapsTraffic.
Initializing new module helper ...
Module helper loaded: MMM-rfacts
Initializing new module helper ...
Module helper loaded: MMM-NiceThings
Initializing new module helper ...
Module helper loaded: DailyXKCD
All module helpers loaded.
Starting server on port 8080 ...
You're using a full whitelist configuration to allow for all IPs
Server started ...
Connecting socket for: MMM-Remote-Control
Starting node helper for: MMM-Remote-Control
Connecting socket for: MMM-ModuleScheduler
Starting node helper for: MMM-ModuleScheduler
Connecting socket for: updatenotification
Connecting socket for: calendar
Starting node helper for: calendar
Connecting socket for: newsfeed
Starting module: newsfeed
Connecting socket for: MMM-PIR
Starting module helper: MMM-PIR
Connecting socket for: MMM-DWD-WarnWeather
MMM-DWD-WarnWeather helper started...
Connecting socket for: MMM-rfacts
Starting module: MMM-rfacts
Connecting socket for: MMM-NiceThings
Starting node_helper for: MMM-NiceThings
Connecting socket for: DailyXKCD
Starting node helper: DailyXKCD
Sockets connected & modules started ...
Launching application.
MMM-ModuleScheduler is removing all scheduled jobs
MMM-ModuleScheduler received CREATE_NOTIFICATION_SCHEDULE
MMM-ModuleScheduler is scheduling REMOTE_ACTION using "0 2 * * *
MMM-ModuleScheduler has scheduled REMOTE_ACTION
MMM-ModuleScheduler will next send REMOTE_ACTION at Mon Apr 23 2018 02:00:00 GMT+0200 (CEST)
Create new calendar fetcher for url: - Interval: 300000
Create new calendar fetcher for url: - Interval: 300000
Create new calendar fetcher for url: - Interval: 300000
Create new news fetcher for url: http://feeds.feedburner.com/blogspot/rkEL?format=xml - Interval: 300000
Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
I made this website for you.
Notification: GET_COMIC Payload: [object Object]
Hi - I just downloaded this module, did npm install, included the config lines in config.js and when I try to launch MagicMirror provides the following errors:
0|mm | Error: The module '/home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build/Release/epoll.node'
0|mm | was compiled against a different Node.js version using
0|mm | NODE_MODULE_VERSION 59. This version of Node.js requires
0|mm | NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
0|mm | the module (for instance, using npm rebuild
or npm install
).
0|mm | at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
0|mm | at Object.Module._extensions..node (module.js:671:18)
0|mm | at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
0|mm | at Module.load (module.js:561:32)
0|mm | at tryModuleLoad (module.js:504:12)
0|mm | at Function.Module._load (module.js:496:3)
0|mm | at Module.require (module.js:586:17)
0|mm | at require (internal/module.js:11:18)
0|mm | at bindings (/home/pi/MagicMirror/modules/MMM-PIR/node_modules/bindings/bindings.js:112:48)
0|mm | at module.exports (/home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/epoll.js:5:31)
Hi everyone,
This is my first post so if i forget to give you informations don't hesitate to tell me. BTW sorry for my english that's not my native language :).
Here is my issue:
When i stay front of my PIR, the screen doesn't turn off, so that's great. But when i leave, the screen turns off only few second before turning back on again.
I have tried to putt the PIR in a black box to be sur the sensor doesn't see me, but same problem. Do you guys have an idea of what is going on ?
Thank you
Edit: I noticed that i have a "Python Callback" that wake up my screen. Might come from DHT22 ? How can i fix this ?
Currently the last activity timestamp is set directly when pir senses movement which is not really helpful information.
I don't know anything about node, but when I try to use this module, the command just exits when it reads the MMM-PIR section of the config file.
My config looks like this;
{
module: 'MMM-PIR',
position: 'bottom_center',
config: {
sensorPin: 22,
delay: 10000,
turnOffDisplay: true,
showCountdown: true,
callbackScripts: ["callback.py"] }
},
If I remove it, it loads fine.
Maybe I'm just missing something.
Hi there, can the countdown be adjusted to only show minutes and seconds in the format mm:ss?
Thanks for your help!
Hello,
Can you updated this module because I imposible to install it because the Node.js version is not up to date.
I have NODE_MODULE_VERSION 73. and NODE_MODULE_VERSION 64. This version of Node.js requires.
this my pm2 logs after [Electron] displayed on my screen :
0|mm | [2020-08-22 09:47:51.986] [ERROR] WARNING! Could not load config file. Starting with default configuration. Error found: Error: The module '/home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build/Release/epoll.node' 0|mm | was compiled against a different Node.js version using 0|mm | NODE_MODULE_VERSION 64. This version of Node.js requires 0|mm | NODE_MODULE_VERSION 73. Please try re-compiling or re-installing 0|mm | the module (for instance, using
npm rebuildor
npm install).
Thanks you
Hi,
if the Display turns off and then it should turned on, the Display is black.
So can you Change the Default Display on and off files to this:
on:
/usr/bin/vcgencmd display_power 1
off:
/usr/bin/vcgencmd display_power 0
Thanks
Daniel
Hello,
After fresh install of your module, set up the config file, and run 'npm start'
have those errors from log:
/home/pi/MagicMirror/node_modules/electron/dist/electron js/electron.js dev: symbol lookup error: /home/pi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build/Release/epoll.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: sh run-start.sh "dev"
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
and my config file is:
{
module: 'MMM-PIR',
position: 'bottom_center',
config: {
sensorPin: 23,
delay: 1000 * 10 * 1, //1000 = 1 sec
turnOffDisplay: true,
showCountdown: true,
callbackScripts: ["callback.py"]
}
},
Can the module be used to turn off a screen via relay, connected over another GPIO port? I added a relay, but I think the screen is only turned off killing the HDMI signal...
Hello,
Would it be possible to insert a French translation.
I enclose the contents of the file fr.json
{
"HEADER": "Délai avant extinction:",
"LAST_USER_PRESENCE": "Dernière activité:",
"TELEGRAM_COMMAND_ERROR": "Erreur lors de l'exécution de la commande {command}
."
}
I thank you in advance.
Is there a way to get this module to send a notification to MMM-NotificationTrigger?
Kugelfang 11 minutes ago
Dear all,
I currently use two modules in my setup which for some unknown reason are cross-interacting in a unwanted way:
MMM-PIR
My config.js looks like this:
{
module: 'MMM-PIR',
position: 'bottom_center',
config: {
sensorPin: 4,
delay: 30000,
turnOffDisplay: true,
showCountdown: true,
callbackScripts: ["callback.py"]
}
},
{
module: "MMM-AVStock",
header: "Stocks",
position: "top_right", //"bottom_bar" is better for `mode:ticker`
config: {
apiKey : "XXXXXXXXXX", // https://www.alphavantage.co/
timeFormat: "DD-MM-YYYY HH:mm:ss",
symbols : ["aapl", "GOOGL", "AMZN"],
alias: ["Apple", "Google", "Amazon"],
tickerDuration: 60,
chartDays: 90,
poolInterval : 1000*15,
mode : "table", // "table", "ticker", "series"
decimals: 2,
candleSticks : false,
coloredCandles : false,
premiumAccount: false,
}
},
Now comes the peculiar thing: if I set
showCountdown: false,
in MMM-PIR the on screen countdown of this module disappears as intended but so does also the list of the AVStock. In fact the header of AVStocks is still there but the actual list does not appear. Also if I change the
mode : "table", // "table", "ticker", "series"
nothing happens. This behavior is fully reversible and reproducible. It would be great if someone could help me out on this.
Hello
I checked out the git repository and ran the npm build command in the directory. When I use the default config Magic Mirror launches but none of the modules load. I see this message on the terminal
bindings (/home/hrishi/MagicMirror/modules/MMM-PIR/node_modules/bindings/bindings.js:112:48)
at /home/hrishi/MagicMirror/modules/MMM-PIR/node_modules/epoll/epoll.js:7:31
[01.01.2022 13:41.42.429] [ERROR] Whoops! There was an uncaught exception...
[01.01.2022 13:41.42.435] [ERROR] Error: The module '/home/hrishi/MagicMirror/modules/MMM-PIR/node_modules/epoll/build/Release/epoll.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. This version of Node.js requires
NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
the module (for instance, using npm rebuild
or npm install
).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1846)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1138:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1846)
at Module.load (internal/modules/cjs/loader.js:935:32)
at Module._load (internal/modules/cjs/loader.js:776:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
at Module.require (internal/modules/cjs/loader.js:959:19)
at require (internal/modules/cjs/helpers.js:88:18)
at bindings (/home/hrishi/MagicMirror/modules/MMM-PIR/node_modules/bindings/bindings.js:112:48)
at /home/hrishi/MagicMirror/modules/MMM-PIR/node_modules/epoll/epoll.js:7:31
Do let me know if you need any other information.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.