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.

    Need "correct" version of node-libgpiod ....

    Scheduled Pinned Locked Moved Solved Troubleshooting
    22 Posts 3 Posters 2.5k Views 3 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.
    • S Offline
      sdetweil @rkorell
      last edited by sdetweil

      @rkorell MM is started by doing node --run or npm start or npm run start

      that matches a script in the scripts section of package.json

      the MagicMirror installed files support 3 different runtimes

      npm start - full using electron

      		"start:x11": "DISPLAY=\"${DISPLAY:=:0}\" ./node_modules/.bin/electron  js/electron.js",
      

      npm run server - server mode only , using node engine

      		"server": "node ./serveronly",
      

      npm run client - UI mode using electron

      node clientonly --address 192.168.1.5 --port 8080
      

      which does this to launch electron, not it doesn’t use the module node_helpers, as its the UI portion
      only… the server side (under full, or server only) does that

      const child = require("node:child_process").spawn(electron, elecParams, options);
      

      as I said before, the electron embedded node engines CAN be different than the install standalone nodejs version

      node -v
      will tell you the standalone node js version.

      the problem you have, I mentioned in the prior post, if the node versions don’t match, then
      you MAY have to recompile when switching runtime choices…

      npm rebuild 
      

      will fix the standalone node version

      electron-rebuild
      

      will fix the electron version

      I believe the current electron version is 22, and the node version we require is 22

      this is because the standalone node version of 24 has dropped support for 32 bit runtimes… and knocks out using the
      32 bit legacy raspi OS images that some use…

      we put out a message to tell the versions when you start MM

      VERSIONS: electron: 36.6.0; used node: 22.15.0; installed node: 22.15.0; npm: 10.9.2; pm2: 6.0.8

      SO… fun times… keeping the node versions synched will avoid the problem you are encountering

      Sam

      How to add modules

      learning how to use browser developers window for css changes

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

        @sdetweil
        Dear Sam, OK, thanks for this.
        Not fully understood…

        How can I

        1. figure out, how my mirror is started? (looooong ago I‘ve used your install script and (if I remember correctly) I‘ve answered „yes“ to „do you want automatically start your mirror at system startup“ - or something similar. - Never took care about, what is done - it worked (and still works)…)
        2. double check the above „VERSIONS“ - message - is this message in logfile?
        3. can I get „keeping the node versions synched“?

        Thanks for further advise!
        Warmest regards,
        Ralf

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

          @rkorell 1. my pm2 setup uses the file

          ~/MagicMirror/installers/mm.sh
          

          you can see that by using the

          pm2 info xxxx
          

          command, where xxx is the name or number of the app row in

          pm2 status 
          

          output, from my desktop , note you CAN setup the SAME NAMED app multiple times,
          so the pm2 start app_name
          might be ambiguous
          so pm2 start 8 would target the app on line 8

          ┌────┬─────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
          │ id │ name                │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
          ├────┼─────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
          │ 8  │ MagicMirror         │ default     │ 2.32.0… │ fork    │ N/A      │ 0      │ 245… │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 7  │ MagicMirror 8       │ default     │ 2.31.0… │ fork    │ N/A      │ 0      │ 8    │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 6  │ MagicMirror1        │ default     │ 2.31.0… │ fork    │ N/A      │ 0      │ 13   │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 0  │ Smart Mirror        │ default     │ 0.0.30  │ fork    │ N/A      │ 0      │ 31   │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 2  │ checkarec           │ default     │ N/A     │ fork    │ 2870     │ 19D    │ 0    │ online    │ 0%       │ 3.4mb    │ sam      │ disabled │
          │ 5  │ smart-mirror        │ default     │ 0.0.31  │ fork    │ N/A      │ 0      │ 8    │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 4  │ smart-mirror ttt    │ default     │ 0.0.30  │ fork    │ N/A      │ 0      │ 10   │ stopped   │ 0%       │ 0b       │ sam      │ disabled │
          │ 3  │ start_alexa_bk      │ default     │ N/A     │ fork    │ 2871     │ 19D    │ 0    │ online    │ 0%       │ 2.4mb    │ sam      │ disabled │
          │ 1  │ startspot           │ default     │ N/A     │ fork    │ 6315     │ 19D    │ 439  │ online    │ 0%       │ 2.5mb    │ sam      │ disabled │
          │ 9  │ testups             │ default     │ N/A     │ fork    │ 2885     │ 19D    │ 0    │ online    │ 0%       │ 3.2mb    │ sam    
          

          using pm2, you can view the log with

          pm2 logs yyy --lines=xxxx
          

          yyy is the name or number of the app from status above), if not supplied,
          output from all managed apps is displayed, 1 after the others

          xxxx is the count of most recent lines to display (default 15)

          you can also see the files(.out and .err, by app) in the

          ~/.pm2/logs
          

          folder

          MM puts out a messages at runtime (this from my desktop system)

          [2025-08-09 09:47:38.743] [INFO]  System information:
          ### SYSTEM:   manufacturer: System manufacturer; model: System Product Name; virtual: false
          ### OS:       platform: linux; distro: Ubuntu; release: 22.04.5 LTS; arch: x64; kernel: 5.15.0-144-generic
          ### VERSIONS: electron: 36.6.0; used node: 22.15.0; installed node: 22.15.0; npm: 10.9.2; pm2: 6.0.8
          ### OTHER:    timeZone: America/Chicago; ELECTRON_ENABLE_GPU: undefined 
          

          notice the versions line

          keep the node versions synced… yes manually (I use the nodejs version of nvm, called n )
          if installed this will show the versions installed

          n list
          

          and

          n
          

          will show the list AND the current one, but you have to type q to exit the list
          (because n updates the /usr/local/bin folder, you have to use sudo to actually install or change the active version)

          or
          if you use my install/upgrade script they will make sure the correct standalone version is installed

          my scripts install and use n if needed to change versions

          Sam

          How to add modules

          learning how to use browser developers window for css changes

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

            @sdetweil Dear Sam,
            thanks again for this long explanation!

            My versions (if I interpret correctly) doesn’t mismatch :-(

            0|MagicMir | ### SYSTEM:   manufacturer: ; model: ; virtual: false
            0|MagicMir | ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: arm64; kernel: 6.12.20+rpt-rpi-2712
            0|MagicMir | ### VERSIONS: electron: 32.2.7; used node: 20.18.1; installed node: 20.18.1; npm: 10.8.2; pm2: 5.4.3
            0|MagicMir | ### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined 
            

            So I’m not sure at all, what to do.

            pi@MagicMirrorPi5:~ $ n list
            node/20.18.1
            
            

            Does show up exact this version, as well.
            Where are my problems from ???
            Thanks a LOT for any idea!

            Ralf

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

              @rkorell

              so, if, in the module folder you do

              npm rebuild
              

              it will fix the version to the standalone node engine

              if you do

              electron-rebuild
              

              it should fix the version to the electron embedded node engine

              if the engine is the same, only one of those is required

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              R 2 Replies Last reply Reply Quote 0
              • R Offline
                rkorell @sdetweil
                last edited by

                @sdetweil OK; thanks.
                I will stop to handle these mismatches.
                Will try to get the MM-Module runnable .
                Console/terminal runs with node may not be necessary …
                Thanks anyway for your kind support!
                Ralf

                1 Reply Last reply Reply Quote 1
                • R Offline
                  rkorell @sdetweil
                  last edited by

                  @sdetweil Dear Sam,
                  just FYI: I’ve just identified that my main problem is NOT the version mismatch but a major change in node-libgpiod’s handling of GPIO-ressources.
                  This was the main reason for mal-function of PIR sensor detection. “Version” was a side effect, not root-cause.
                  I’m nearly done with this and it seems that it will work as intended…

                  Thanks again for your support!

                  Regards,
                  Ralf

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

                    @rkorell awesome. yes gpio changes are a pain!!

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    R 2 Replies Last reply Reply Quote 0
                    • R Offline
                      rkorell @sdetweil
                      last edited by

                      @sdetweil yes, indeed …

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

                        @rkorell Do have any any resources for your current development? I’m also stucking at a similar problem handling GPIO for buttons using a Raspberry Pi 5.
                        Do you have a Github Repository?

                        R 1 Reply Last reply Reply Quote 0
                        • R Offline
                          rkorell @schlomm
                          last edited by rkorell

                          @schlomm I’m absolute beginner …
                          Had HEAVILY used AI to get this done and have recycled a LOT.

                          GPIO part is from old (discontinued) module MMM-Pir from Bugsounet.
                          This is reflected in pirLib.js - sliightly modified for my purposes.

                          I do have a repository - pushed literally minutes ago …
                          Feel free to have a look.

                          Buttons should work with some modification. Essentiall for my purposes I simply query state of a single GPIO pin - to which a PIR sensor is connected. Code must be enhanced to handle more than one pin - if you are talking about “butons” - which signals plural…

                          As mentioned such modification should be doable with AI as well.

                          [ EDIT : My system is a raspi5 / bookworm as well - this is main reason for some difficulties. Some procedures simply doesn’t work anymore with new libraries and I had to change implementation…]

                          Good luck!
                          Warm regards,
                          Ralf

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

                            @sdetweil Dear Sam,
                            I was able to get this done - to my big surprise …
                            As announced, I just have pushed it to git and will post a corresponding message tomorrow.
                            Do I get it right that it is recommended to edit the modules page as well?
                            And the 3rd Party Modules page then will populate by itself, right?
                            Thanks!

                            Warmest regards,
                            Ralf

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

                              @rkorell yes, you edit the wiki page, and then the 3rd party list will pick up those changes on the next refresh (once a day)

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              R 1 Reply Last reply Reply Quote 1
                              • R rkorell has marked this topic as solved on
                              • R Offline
                                rkorell @sdetweil
                                last edited by

                                @sdetweil thx!

                                S 1 Reply Last reply Reply Quote 1
                                • S Offline
                                  schlomm @rkorell
                                  last edited by

                                  @rkorell Thanks for publishing your great module. I already use it and hell yeah - it’s great :)
                                  I was also able to make the needed modification to my “Buttons”-module using the node-libgpiod package. Main reason why it was not working was the missing postinstall script.

                                  Thanks and “schöne Grüße” :)

                                  R 1 Reply Last reply Reply Quote 1
                                  • R Offline
                                    rkorell @schlomm
                                    last edited by

                                    @schlomm
                                    This is really cool.
                                    Awesome that it works as designed…
                                    (Was a little bit afraid that especially postinstall will fail and module doesn‘t work as expected…)
                                    So thanks for (first !) confirmation for working module!

                                    Warmest regards,
                                    Ralf

                                    • Schöne Grüße zurück - danke für‘s Kompliment und Danke für‘s „externe“ Testen! :-)
                                    1 Reply Last reply Reply Quote 0

                                    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
                                    • 1
                                    • 2
                                    • 1 / 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