MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-PIR-Sensor Guide with Edits and Updates

    Scheduled Pinned Locked Moved Development
    20 Posts 15 Posters 16.5k Views 17 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      msherwood
      last edited by

      shit, this killed my MM build…it’s all blank…crap

      1 Reply Last reply Reply Quote 0
      • A Offline
        ardentaardvark
        last edited by

        @msherwood Hey FYI I just got my lastest build (from scratch yesterday) working with MMM-PIR-Sensor:

        I also found that npm install wiring-pi installed the old (2.25) version for me. I found a newer library:

        npm install wiring-pi-2019

        which installs version 2.5 (this one works on my pi4!).

        I also found that the location of the tvservice binary has changed, so I just used the following bash commands:

        sudo chmod u+s `which tvservice`
        sudo chmod u+s `which chvt`
        

        It then worked for me (Note, I did not modify the node_helper.js script at all.)

        1 Reply Last reply Reply Quote 0
        • D Offline
          dubalda
          last edited by

          Hi all, unfortunately I’m not too familiar with coding but had this module failed to update today having followed the steps above which worked fine with the previous version.

          Has anyone else experienced this?

          Thanks

          FoziF 1 Reply Last reply Reply Quote 0
          • FoziF Offline
            Fozi Project Sponsor @dubalda
            last edited by

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

            HowTo: Replace PIR Sensor with a RCWL-0516 Microwave Sensor

            D 1 Reply Last reply Reply Quote 0
            • Feedy88F Offline
              Feedy88
              last edited by

              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?

              S 1 Reply Last reply Reply Quote 0
              • D Offline
                dubalda @Fozi
                last edited by

                @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::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:12:44: error: expected primary-expression before ‘>’ token
                bool HasInstance(v8::Handlev8::Value val);
                ^
                …/src/addon.h:12:46: error: ‘val’ was not declared in this scope
                bool HasInstance(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
                bool HasInstance(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:12:12: note: ‘bool node::Buffer::HasInstance’ previously defined here
                bool HasInstance(v8::Handlev8::Value val);
                ^~~~~~~~~~~
                …/src/addon.h:13:28: error: ‘Handle’ is not a member of ‘v8’
                bool HasInstance(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:13:45: error: expected primary-expression before ‘>’ token
                bool HasInstance(v8::Handlev8::Object val);
                ^
                …/src/addon.h:13:47: error: ‘val’ was not declared in this scope
                bool HasInstance(v8::Handlev8::Object val);
                ^~~
                …/src/addon.h:14:22: error: ‘Handle’ is not a member of ‘v8’
                char
                Data(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:14:38: error: expected primary-expression before ‘>’ token
                char
                Data(v8::Handlev8::Value val);
                ^
                …/src/addon.h:14:40: error: ‘val’ was not declared in this scope
                char* Data(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
                char* Data(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:14:13: note: ‘char* node::Buffer::Data’ previously defined here
                char* Data(v8::Handlev8::Value val);
                ^~~~
                …/src/addon.h:15:22: error: ‘Handle’ is not a member of ‘v8’
                char* Data(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:15:39: error: expected primary-expression before ‘>’ token
                char* Data(v8::Handlev8::Object val);
                ^
                …/src/addon.h:15:41: error: ‘val’ was not declared in this scope
                char* Data(v8::Handlev8::Object val);
                ^~~
                …/src/addon.h:16:25: error: ‘Handle’ is not a member of ‘v8’
                size_t Length(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:16:41: error: expected primary-expression before ‘>’ token
                size_t Length(v8::Handlev8::Value val);
                ^
                …/src/addon.h:16:43: error: ‘val’ was not declared in this scope
                size_t Length(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
                size_t Length(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:16:14: note: ‘size_t node::Buffer::Length’ previously defined here
                size_t Length(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:17:25: error: ‘Handle’ is not a member of ‘v8’
                size_t Length(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:17:42: error: expected primary-expression before ‘>’ token
                size_t Length(v8::Handlev8::Object val);
                ^
                …/src/addon.h:17:44: error: ‘val’ was not declared in this scope
                size_t Length(v8::Handlev8::Object 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::MaybeLocalv8::String)’
                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::Localv8::Value v8::Exception::Error(v8::Localv8::String)’
                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::MaybeLocalv8::String’ to ‘v8::Localv8::String’
                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::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:12:44: error: expected primary-expression before ‘>’ token
                bool HasInstance(v8::Handlev8::Value val);
                ^
                …/src/addon.h:12:46: error: ‘val’ was not declared in this scope
                bool HasInstance(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:13:28: error: redefinition of ‘bool node::Buffer::HasInstance’
                bool HasInstance(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:12:12: note: ‘bool node::Buffer::HasInstance’ previously defined here
                bool HasInstance(v8::Handlev8::Value val);
                ^~~~~~~~~~~
                …/src/addon.h:13:28: error: ‘Handle’ is not a member of ‘v8’
                bool HasInstance(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:13:45: error: expected primary-expression before ‘>’ token
                bool HasInstance(v8::Handlev8::Object val);
                ^
                …/src/addon.h:13:47: error: ‘val’ was not declared in this scope
                bool HasInstance(v8::Handlev8::Object val);
                ^~~
                …/src/addon.h:14:22: error: ‘Handle’ is not a member of ‘v8’
                char
                Data(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:14:38: error: expected primary-expression before ‘>’ token
                char
                Data(v8::Handlev8::Value val);
                ^
                …/src/addon.h:14:40: error: ‘val’ was not declared in this scope
                char* Data(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:15:22: error: redefinition of ‘char* node::Buffer::Data’
                char* Data(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:14:13: note: ‘char* node::Buffer::Data’ previously defined here
                char* Data(v8::Handlev8::Value val);
                ^~~~
                …/src/addon.h:15:22: error: ‘Handle’ is not a member of ‘v8’
                char* Data(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:15:39: error: expected primary-expression before ‘>’ token
                char* Data(v8::Handlev8::Object val);
                ^
                …/src/addon.h:15:41: error: ‘val’ was not declared in this scope
                char* Data(v8::Handlev8::Object val);
                ^~~
                …/src/addon.h:16:25: error: ‘Handle’ is not a member of ‘v8’
                size_t Length(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:16:41: error: expected primary-expression before ‘>’ token
                size_t Length(v8::Handlev8::Value val);
                ^
                …/src/addon.h:16:43: error: ‘val’ was not declared in this scope
                size_t Length(v8::Handlev8::Value val);
                ^~~
                …/src/addon.h:17:25: error: redefinition of ‘size_t node::Buffer::Length’
                size_t Length(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:16:14: note: ‘size_t node::Buffer::Length’ previously defined here
                size_t Length(v8::Handlev8::Value val);
                ^~~~~~
                …/src/addon.h:17:25: error: ‘Handle’ is not a member of ‘v8’
                size_t Length(v8::Handlev8::Object val);
                ^~~~~~
                …/src/addon.h:17:42: error: expected primary-expression before ‘>’ token
                size_t Length(v8::Handlev8::Object val);
                ^
                …/src/addon.h:17:44: error: ‘val’ was not declared in this scope
                size_t Length(v8::Handlev8::Object 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::MaybeLocalv8::String)’
                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::Localv8::Value v8::Exception::Error(v8::Localv8::String)’
                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::MaybeLocalv8::String’ to ‘v8::Localv8::String’
                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%)

                1 Reply Last reply Reply Quote 0
                • FoziF Offline
                  Fozi Project Sponsor
                  last edited by

                  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

                  HowTo: Replace PIR Sensor with a RCWL-0516 Microwave Sensor

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Fozi
                    last edited by

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

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    S 1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @sdetweil
                      last edited by

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

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        dubalda
                        last edited by

                        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.

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 2 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy