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

MMM-PIR-Sensor Guide with Edits and Updates


  • Project Sponsor

    @dubalda can you elaborate more detailed the failure, e.g, error message or similar?



  • I am curious to know if there is a benefit by using the MM-Module for the PIR vs. the executable script which can be autostarted with pm2 (as per this tutorial). Can anyone help?



  • @Fozi thank you for coming back to me. Here are the error messages I’m getting…apologies if it’s quite long! I unfortunately wasn’t able to upload the log file.

    pi@pi:~/MagicMirror/modules/MMM-PIR-Sensor $ git pull
    Updating be81cf0…d4831f2
    Fast-forward
    README.md | 14 ++++++++++++++
    node_helper.js | 46 ++++++++++++++++++++++++++++++++++++++++++++±
    2 files changed, 59 insertions(+), 1 deletion(-)
    pi@pi:~/MagicMirror/modules/MMM-PIR-Sensor $ npm install

    Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall /home/pi/MagicMirror/modules/MMM-PIR-Sensor
    electron-rebuild -e …/…/node_modules/electron

    â Rebuild Failed

    An unhandled error occurred inside electron-rebuild
    make: Entering directory ‘/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019/build’
    CXX(target) Release/obj.target/wiringPi/src/addon.o
    In file included from /home/pi/.electron-gyp/6.1.7/include/node/v8-internal.h:14,
    from /home/pi/.electron-gyp/6.1.7/include/node/v8.h:25,
    from …/src/addon.h:4,
    from …/src/addon.cc:1:
    /home/pi/.electron-gyp/6.1.7/include/node/v8config.h:326:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
    declarator attribute((deprecated(message)))
    ^
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:8205:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
    V8_DEPRECATE_SOON(“Use *WithData version.”,
    ^~~~~~~~~~~~~~~~~
    /home/pi/.electron-gyp/6.1.7/include/node/v8config.h:326:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
    declarator attribute((deprecated(message)))
    ^
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:8214:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
    V8_DEPRECATE_SOON(“Use *WithData version.”,
    ^~~~~~~~~~~~~~~~~
    In file included from …/src/addon.cc:1:
    …/src/addon.h:12:28: error: ‘Handle’ is not a member of ‘v8’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:12:44: error: expected primary-expression before ‘>’ token
    bool HasInstance(v8::Handle val);
    ^
    …/src/addon.h:12:46: error: ‘val’ was not declared in this scope
    bool HasInstance(v8::Handle val);
    ^~~
    …/src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:12:12: note: ‘bool node::Buffer::HasInstance’ previously defined here
    bool HasInstance(v8::Handle val);
    ^~~~~~~~~~~
    …/src/addon.h:13:28: error: ‘Handle’ is not a member of ‘v8’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:13:45: error: expected primary-expression before ‘>’ token
    bool HasInstance(v8::Handle val);
    ^
    …/src/addon.h:13:47: error: ‘val’ was not declared in this scope
    bool HasInstance(v8::Handle val);
    ^~~
    …/src/addon.h:14:22: error: ‘Handle’ is not a member of ‘v8’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:14:38: error: expected primary-expression before ‘>’ token
    char* Data(v8::Handle val);
    ^
    …/src/addon.h:14:40: error: ‘val’ was not declared in this scope
    char* Data(v8::Handle val);
    ^~~
    …/src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:14:13: note: ‘char* node::Buffer::Data’ previously defined here
    char* Data(v8::Handle val);
    ^~~~
    …/src/addon.h:15:22: error: ‘Handle’ is not a member of ‘v8’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:15:39: error: expected primary-expression before ‘>’ token
    char* Data(v8::Handle val);
    ^
    …/src/addon.h:15:41: error: ‘val’ was not declared in this scope
    char* Data(v8::Handle val);
    ^~~
    …/src/addon.h:16:25: error: ‘Handle’ is not a member of ‘v8’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:16:41: error: expected primary-expression before ‘>’ token
    size_t Length(v8::Handle val);
    ^
    …/src/addon.h:16:43: error: ‘val’ was not declared in this scope
    size_t Length(v8::Handle val);
    ^~~
    …/src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:16:14: note: ‘size_t node::Buffer::Length’ previously defined here
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:17:25: error: ‘Handle’ is not a member of ‘v8’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:17:42: error: expected primary-expression before ‘>’ token
    size_t Length(v8::Handle val);
    ^
    …/src/addon.h:17:44: error: ‘val’ was not declared in this scope
    size_t Length(v8::Handle val);
    ^~~
    …/src/addon.cc: In function ‘void throw_error(v8::Isolate*, const char*, …)’:
    …/src/addon.cc:35:90: error: no matching function for call to ‘v8::Exception::Error(v8::MaybeLocal)’
    isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(isolate, buffer)));
    ^
    In file included from …/src/addon.h:4,
    from …/src/addon.cc:1:
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:6538:23: note: candidate: ‘static v8::Local v8::Exception::Error(v8::Local)’
    static Local Error(Local message);
    ^~~~~
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:6538:23: note: no known conversion for argument 1 from ‘v8::MaybeLocal’ to ‘v8::Local’
    make: *** [wiringPi.target.mk:147: Release/obj.target/wiringPi/src/addon.o] Error 1
    make: Leaving directory ‘/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019/build’
    gyp ERR! build error
    gyp ERR! stack Error: make failed with exit code: 2
    gyp ERR! stack at ChildProcess.onExit (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/node-gyp/lib/build.js:194:23)
    gyp ERR! stack at ChildProcess.emit (events.js:198:13)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
    gyp ERR! System Linux 4.19.118-v7l+
    gyp ERR! command “/usr/bin/node” “/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/.bin/node-gyp” “rebuild” “–target=6.1.7” “–arch=arm” “–dist-url=https://www.electronjs.org/headers” “–build-from-source”
    gyp ERR! cwd /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019
    gyp ERR! node -v v10.21.0
    gyp ERR! node-gyp -v v6.1.0
    gyp ERR! not ok

    Failed with exit code: 1

    Error: make: Entering directory ‘/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019/build’
    CXX(target) Release/obj.target/wiringPi/src/addon.o
    In file included from /home/pi/.electron-gyp/6.1.7/include/node/v8-internal.h:14,
    from /home/pi/.electron-gyp/6.1.7/include/node/v8.h:25,
    from …/src/addon.h:4,
    from …/src/addon.cc:1:
    /home/pi/.electron-gyp/6.1.7/include/node/v8config.h:326:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
    declarator attribute((deprecated(message)))
    ^
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:8205:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
    V8_DEPRECATE_SOON(“Use *WithData version.”,
    ^~~~~~~~~~~~~~~~~
    /home/pi/.electron-gyp/6.1.7/include/node/v8config.h:326:49: warning: ‘MicrotasksCompletedCallback’ is deprecated [-Wdeprecated-declarations]
    declarator attribute((deprecated(message)))
    ^
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:8214:3: note: in expansion of macro ‘V8_DEPRECATE_SOON’
    V8_DEPRECATE_SOON(“Use *WithData version.”,
    ^~~~~~~~~~~~~~~~~
    In file included from …/src/addon.cc:1:
    …/src/addon.h:12:28: error: ‘Handle’ is not a member of ‘v8’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:12:44: error: expected primary-expression before ‘>’ token
    bool HasInstance(v8::Handle val);
    ^
    …/src/addon.h:12:46: error: ‘val’ was not declared in this scope
    bool HasInstance(v8::Handle val);
    ^~~
    …/src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:12:12: note: ‘bool node::Buffer::HasInstance’ previously defined here
    bool HasInstance(v8::Handle val);
    ^~~~~~~~~~~
    …/src/addon.h:13:28: error: ‘Handle’ is not a member of ‘v8’
    bool HasInstance(v8::Handle val);
    ^~~~~~
    …/src/addon.h:13:45: error: expected primary-expression before ‘>’ token
    bool HasInstance(v8::Handle val);
    ^
    …/src/addon.h:13:47: error: ‘val’ was not declared in this scope
    bool HasInstance(v8::Handle val);
    ^~~
    …/src/addon.h:14:22: error: ‘Handle’ is not a member of ‘v8’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:14:38: error: expected primary-expression before ‘>’ token
    char* Data(v8::Handle val);
    ^
    …/src/addon.h:14:40: error: ‘val’ was not declared in this scope
    char* Data(v8::Handle val);
    ^~~
    …/src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:14:13: note: ‘char* node::Buffer::Data’ previously defined here
    char* Data(v8::Handle val);
    ^~~~
    …/src/addon.h:15:22: error: ‘Handle’ is not a member of ‘v8’
    char* Data(v8::Handle val);
    ^~~~~~
    …/src/addon.h:15:39: error: expected primary-expression before ‘>’ token
    char* Data(v8::Handle val);
    ^
    …/src/addon.h:15:41: error: ‘val’ was not declared in this scope
    char* Data(v8::Handle val);
    ^~~
    …/src/addon.h:16:25: error: ‘Handle’ is not a member of ‘v8’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:16:41: error: expected primary-expression before ‘>’ token
    size_t Length(v8::Handle val);
    ^
    …/src/addon.h:16:43: error: ‘val’ was not declared in this scope
    size_t Length(v8::Handle val);
    ^~~
    …/src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:16:14: note: ‘size_t node::Buffer::Length’ previously defined here
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:17:25: error: ‘Handle’ is not a member of ‘v8’
    size_t Length(v8::Handle val);
    ^~~~~~
    …/src/addon.h:17:42: error: expected primary-expression before ‘>’ token
    size_t Length(v8::Handle val);
    ^
    …/src/addon.h:17:44: error: ‘val’ was not declared in this scope
    size_t Length(v8::Handle val);
    ^~~
    …/src/addon.cc: In function ‘void throw_error(v8::Isolate*, const char*, …)’:
    …/src/addon.cc:35:90: error: no matching function for call to ‘v8::Exception::Error(v8::MaybeLocal)’
    isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8(isolate, buffer)));
    ^
    In file included from …/src/addon.h:4,
    from …/src/addon.cc:1:
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:6538:23: note: candidate: ‘static v8::Local v8::Exception::Error(v8::Local)’
    static Local Error(Local message);
    ^~~~~
    /home/pi/.electron-gyp/6.1.7/include/node/v8.h:6538:23: note: no known conversion for argument 1 from ‘v8::MaybeLocal’ to ‘v8::Local’
    make: *** [wiringPi.target.mk:147: Release/obj.target/wiringPi/src/addon.o] Error 1
    make: Leaving directory ‘/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019/build’
    gyp ERR! build error
    gyp ERR! stack Error: make failed with exit code: 2
    gyp ERR! stack at ChildProcess.onExit (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/node-gyp/lib/build.js:194:23)
    gyp ERR! stack at ChildProcess.emit (events.js:198:13)
    gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
    gyp ERR! System Linux 4.19.118-v7l+
    gyp ERR! command “/usr/bin/node” “/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/.bin/node-gyp” “rebuild” “–target=6.1.7” “–arch=arm” “–dist-url=https://www.electronjs.org/headers” “–build-from-source”
    gyp ERR! cwd /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/wiring-pi-2019
    gyp ERR! node -v v10.21.0
    gyp ERR! node-gyp -v v6.1.0
    gyp ERR! not ok

    Failed with exit code: 1
    at SafeSubscriber._error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/spawn-rx/lib/src/index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:156:26)
    at Subscriber._error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:92:26)
    at Subscriber.error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:72:18)
    at SafeSubscriber._next (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/spawn-rx/lib/src/index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:205:16)
    at SafeSubscriber.next (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/rxjs/internal/Subscriber.js:143:22)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 255
    npm ERR! Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall: electron-rebuild -e ../../node_modules/electron
    npm ERR! Exit status 255
    npm ERR!
    npm ERR! Failed at the Magic-Mirror-Module-PIR-Sensor@1.1.0 postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /home/pi/.npm/_logs/2020-07-16T09_45_07_608Z-debug.log
    [0_1595277021862_PIR-Sensor Error logs.txt](Uploading 100%)


  • Project Sponsor

    I‘d delete the module and re-install it. Obviously you haven’t changed any code (no info on stashing in the log). Your configuration will not be affected when you delete the module, it‘ll persist in config. js.

    1. stop all processes with entering pm2 stop all.
    2. cd to the module folder and enter: sudo rm -R MMM-PIR-Sensor. This will recursively remove the MMM-PIR-Sensor folder and it’s contents.
    3. Re-install the module as described on GitHub. The installation build process should run through without errors.
    4. Reboot


  • @Fozi rm -rf foldername will recursively remove all folders and content from foldername



  • @sdetweil looks like the wrong compiler level being used for the recompile.



  • Thanks guys, sorry for the late response! It’s the summer holidays so I’ve been doing daddy day care. I’ll try removing the module and reinstalling it. I’ll keep you posted.



  • @Feedy88
    Works with out any problems, much better solution then MMM-PIR-Sensor.
    Thanks


Log in to reply